Page 1 of 1

Render Camera Becomes Null After Loading

Posted: Fri Jul 19, 2024 3:04 am
by pixelemm
Hi,

I'm having an issue where after I load a save slot, my canvas' Render Camera becomes null.
The render camera is correct when starting up the game. I hope there is a way to solve this.

I've attached some screenshots to illustrate the problem.
Before start
Before start
01.png (466.7 KiB) Viewed 685 times
During Start
During Start
02.png (859.78 KiB) Viewed 685 times
After loading
After loading
03.png (765.83 KiB) Viewed 685 times

Re: Render Camera Becomes Null After Loading

Posted: Fri Jul 19, 2024 10:58 am
by Tony Li
Hi,

This is probably the same issue as described in How To: Manage Player Controls and Scene Changes. Please see that link and let me know if you have any questions. The issue is that the Dialogue Manager survives the scene change, but the render camera doesn't. (The render camera probably shouldn't survive scene changes.) In this case, you'll want to write a very small script or something to reconnect the newly-loaded scene's render camera.

Re: Render Camera Becomes Null After Loading

Posted: Tue Aug 06, 2024 3:18 am
by pixelemm
Hi,

I got it to work by writing a small script that uses a coroutine to constantly check if the desired camera exists and assign it to the dialogue system!

Thanks for the reply

Re: Render Camera Becomes Null After Loading

Posted: Tue Aug 06, 2024 9:39 am
by Tony Li
Hi,

Sounds good. But you could probably optimize it by checking once in a Start() method, and putting that script on a GameObject (e.g., empty GameObject) in each scene. That way you don't have to constantly check.