[BUG] set Camera Controller Anchor to non-bone in inspector is ignored

DankP3

Active member
I think we discussed something very similar in the past, but cannot find the old forum post.

1. Character controller variant (Ultimate Character Controller, First Person Controller, etc).
UCC 2.1.10

2. Unity version (include which SRP, beta Unity versions aren't supported)
2019.3.0f6, HDRP

3. Bug description

Observed: Camera Controller has an option to set the Anchor Transform in the inspector, but this is nullified and never used.

Expected: Camera Controller to accept non-bone transforms as an anchor.

4. Steps to reproduce
In demo scene:
Add empty GameObject to Nolan.
Drag this GO to the Anchor on CameraController (doesn't appear to make a difference if Nolan is selected in the inspector and set to Initialize on Awake).
hit test and observe Anchor defaults to Nolan Transform.

5. The full error message (if any)
N/A

Note: Ignoring both lines 426 and 439 (both "m_Anchor = null" ) of the CameraController seemed to allow all 3 possible options to work, but not sure why it is nullified.

Thanks
 
Thanks for the report. Commenting out line 439 will work, and then I added the following to InitializeAnchor:

Code:
            if (m_AutoAnchor && (anchor = m_Character.GetComponent<Animator>().GetBoneTransform(m_AutoAnchorBone)) != null) {
                m_Anchor = anchor;
            } else if (m_Anchor != null && !m_Anchor.IsChildOf(m_Character.transform)) { // NEW
                m_Anchor = null; // NEW
            } // NEW
 
This only works for me if I also comment out line 426? both in my scene and with the UCC demo scene.
Could my setup somehow differ or is this a mistake on your part and both 426 and 439 need to be removed. In my previous debug, both always ran on startup.
 
Oops, yes, I mentioned the wrong line. It is line 426 that you want to comment out, and leave 439 there.
 
OK, so that works as the demo scene is setup, but my scene with UMA uses Initialize on Awake and this then fails if line 426 is not ignored. Nolan also fails if you set him to Initialize on Awake with line 426 not commented out.

So my problem is that with my UMA, if i don't set to initialise on awake, or If i do, but with the Player tag and no character assigned in the inspector, it is giving me the no look source attached. Any ideas why (I'd have thought with the Player tag it should be fine. the camera controller finds the player but still gives the look source error)?

So essentially. my setup requires Initialize on Awake and my UMA assigned in the inspector or it fails. And to set an anchor in the inspector in this setup, i need both lines commented out?

Thanks for any ideas about what i may have wrong...
 
with line 426 not commented out.
Line 426 should be commented out, line 439 should not be. Line 439 will only occur if a null character is set, and that will set the anchor to null. Really that line could also be commented out since when the character reinitializes it will initializes the anchor as well. So feel free to comment out both lines.
 
Sorry to necro this post but this issue still exist as of today. Any plans to push this into an update?
 
I just tested this and was not able to reproduce it. When I set an arbitrary GameObject to the anchor field it was accepted after I hit play.
 
Closing the loop on this, I just installed version 2.4.3 and this feature is working as expected. I tested both dragging and setting the anchor programmatically and it worked. Thanks Justin.
 
Top