Checking the scene/Level you are?

Hello Unity Answers.

A simple question:

How can I check in code the scene I am? I have a timer that is supposed to start when the scene start (This scene is the 4th level) And the timer start on the first level.

just something like:

if(Scene == Level1){

start timer //I know this is wrong, so dont tell me that.


Application.loadedLevelName is obsolete. You need to use…

if (someString == SceneManager.GetActiveScene().name)
    //do stuff


SceneManager.GetActiveScene in the scripting API