how to read active scene name in unity code example
Example 1: unity how to see what scen you are in
void Update()
{
if (SceneManager.GetActiveScene () == SceneManager.GetSceneByName ("scene1"))
{
SceneManager.LoadScene ("scene2");
}
else if (SceneManager.GetActiveScene () == SceneManager.GetSceneByName ("scene2"))
{
SceneManager.LoadScene ("scene1");
}
}
Example 2: unity how to get the current scene
SceneManager.GetActiveScene().buildIndex;