- Home /
Question by
LW · Dec 18, 2017 at 02:31 PM ·
gameobjectscenedontdestroyonload
GameObject::scene and DontDestroyOnLoad()
Hi,
If I assign a GameObject
to the DontDestroyOnLoad()
method and then call print(gameObject.scene.name)
it prints out "DontDestroyOnLoad" instead of the scene name. Is there a way to get the scene in which the object was created after assigning it to DontDestroyOnLoad()
?
I know it can be done prior but I'm looking for a way to check after without storing a variable.
Thanks,
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612144814im_/https://answers.unity.com/themes/thub/images/avi.jpg)