DontDestroyOnLoad not working?

Hi,

I have an object with many children. I would like for the object and it’s children to not be destroyed after I load a new scene, but it doesn’t work on a web build.

It works in the editor, but when I build it as a web player I get at NullException errror.

Any suggestions?

Thank you,
Sandro

You should just have to put this on the parent object:
DontDestroyOnLoad(gameObject);

It doesn’t sound right that it is working in the Editor but not the Webplayer. It works for everyone else, as far as I know, including myself. Are you sure it isn’t an error unrelated to DontDestroyOnLoad()?

You can view the Console log, if you haven’t already, by opening /Applications/Utilities/Console.app and choosing File->Open Console Log.

Cheers,
-Jon

Hi,

Thanks for your response. Actually, I did open the Console.log, that’s how I was able to see that the problem is a NullReference exception. I do agree, it’s odd, but it might also have to do with the object being disabled up until the point that it’s needed.

Thank you,
Sandro