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!
↧