- Home /
DontDestroyOnLoad Slowing Loading Down
Hello,
I recently tried this Object.DontDestroyOnLoad function since I have two scenes sharing two heavy objects. All I wanted to do was speeding things up a little bit when the player wanted to go from one scene to the other. But instead it did the opposite. Now loading times are 3x longer. Why would it be this way?
I use the functions on the objects that I don't want destroyed like below:
function Awake () {
DontDestroyOnLoad (transform.gameObject);
}
I am developing for Android by the way. Thanks.
Normally you would DontDestroyOnLoad an object in a startup scene that is never reloaded - is it possible you are just creating more and more of these objects? If you keep loading a scene with the object in you will just get another copy.
Yes, I checked for that. I instantiate only once at the beginning. Then if the scene is reloaded, I check for existing copy before instantaiting. So that's not the issue.