If(Application.isPlaying == "MainMenu") then Show A messenger. take a info

Hi! i want to make a general Script for 2 Scenes

If i put this code to an empty object then i have want show me a messenger like
“Nice To Meet Ya” at scene with name “MainMenu” and one different scene with name “FirstPlane” to show me the Debug Logs messenger “Love you”.

my code is as following:

function Update () {
   if(Application.isPlaying == "MainPage") {
      Debug.Log("Nice to Meet Ya");
   }
   if(Application.isPlaying == "FirstPlane") {
      Debug.Log("I am bored");
   }
}

but when i am trying to start PlayMode i didn’t see to control any messenger. Why?

1 Answer

1

The Application function you are calling can’t be used that way.

Instead try using

That will allow you to test which level is loaded.

I hope this has helped. If you consider your question resolved, please consider marking the answer as correct.