How to make a level type a variable in able to change in inspector view?

For example This is in C#

void OnMouseEnter() 
  {
    Application.LoadLevel("Example Level");

  }

there’s more things I didn’t put in the code but how can i do a

public void (vartype) myLevel ;

I’m new so I don’t know how to make lots of things yet. and making some things changeable in the inspector view I can’t make. you don’t have to put ur own code at least put a link to the reference were i can learn more.

1 Answer

1

Okay I researched the Internet and I found what to do. Instead of making a variable of some type of level I don’t think this is even possible so what I found on a site is just make a variable type of string and assign it as your level.

public string myLevel;
void OnMouseDown () {

Application.LoadLevel(myLevel); 

}

So what this those is make myLevel open to be changeable to the public and also a string so when you put the Application.LoadLevel(myLevel);

since myLevel is a string you won’t need “” and in the Inspector you just put the level name and It’s easy to go along. Lol, I may sound so instruct-able but I’m still learning. Hopefully if any of you know a better way please answer, as I’m still trying to learn new ways to do things.

Congratulations for discovering how to use variables ;)