No look source when changing scene when using UCC char with AC

dasjlm

Member
I'm having a problem switching scenes. And seems to be a catch 22.

If I set the CameraController to InitOnAwake it doesn't work in the second scene.
I can see the UCC char in the scene hierarchy but the CameraController has null for the character.

I get the impression that since the UCC char was already loaded in the first scene when it gets to the second scene it detects the no look source before the AC scene runs the START code.

To test I added a wait just before the scene switch then I disable the UCC Locomotion script on the UCC player in the first scene and when the scene switches I do not get the error and the CameraController InitOnAwake work. Looks like I can get around the problem by toggling the UCC Locomotion script. Strange but suspect but multiple products are always complicated in Unity. I also had to toggle thing is Salsa on the char. Oh well I think I can move forward.

Does that sound okay.

John
 
The look source does need to exist before the character. You can spawn things at runtime though and hook everything up, under DontDestroyOnLoad:

 
I commenting out the error triggered in the editor as that seemed to stop things. The CameraController code continues and does looks for the player and assigns it okay. I suspect it's a timing issue of some kind. Perhaps a editor warning instead of error would be better.
 
Using DontDestroyOnLoad in general can be tricky, but basically if you set one object as DontDestroyOnLoad, i.e. the character in this case, then you need to make sure anything else that directly references it also gets set to DontDestroyOnLoad, i.e. the camera (and UI).
 
Top