Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

How to detect when scene has changed in a DontDestroyOnLoad script?

$
0
0
Good day. I have a script with DontDestroyOnLoad property. I need to run one method when one scene in particular is loaded. Its clear i need to check for the activeScene , but i dont know how to trigger code when a scene is loaded. (It seems OnLevelWasLoaded does not work anymore..). I dont get how to do it with: https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager-activeSceneChanged.html Some help please? to detect the scene i know is: if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Something") { RunMyFunctions(); } Where i need to put this to make it run only when a scene is loaded? Thaanks!

Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>