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 don’t know how to trigger code when a scene is loaded. (It seems OnLevelWasLoaded
does not work anymore…).
I don’t get how to do it with:
Some help please?
To detect the scene I know is:
using UnityEngine.SceneManagement;
if( SceneManager.GetActiveScene().name=="Something")
{
RunMyFunctions();
}
Where I need to put this to make it run only when a scene is loaded?
Thaanks!