Loading a Level that I can change?

I am trying to make a code where the game will load a level name that you can change in the inspector. I’m guessing its something like:

public float levelName = "1"

//If something happens
Application.LoadLevel(levelName);

Is this right?

Wrong. LoadLevel() either takes a string argument which should resemble the level name, or it takes an int which resembles the index of the level in your build options’ level list.
So either use

public int levelName = 1;

or

public string levelName = "level 1";
1 Like

OK, thanks!