How to check what scene is running.

I need a piece of code like this:

if(whateverSceneIsRunning.name == "Menu"){
      DoWhateverHere();
}

I have looked everywhere for something like this but to no avail. Please help! Thanks!

To get the name of the scene, use: Application.loadedLevelName.

For the integer equivalent: Application.loadedLevel.

You know how I got this? I searched in the scripting reference.

Thanks! I searched the scripting reference too. I just couldn’t find anything. Mostly because I didn’t know what it was that I was looking for.