- Home /
Selecting scene for your main menu
Hey, al my scripts function except I've added a restriction to mouse orbit when the player is in the main menu. My main menu if scene 0. My first level is placed in scene 1. I believe I've made a mistake in the coding and it would be nice to have a simple line of coding that lets me define what scenes I wish to allow mouse orbit. Thanks for your time -DudeSayDude
Answer by syclamoth · Dec 01, 2011 at 11:33 AM
This is a bit of an unusual way of doing things (I would just put the mouseOrbit in one scene, and not in the other, and then when you load the scene the camera control loads with it), but here's how you'd do it-
void OnLevelWasLoaded(int curLevel)
{
if(curLevel == 0)
{
enabled = false;
} else {
enabled = true;
}
}
Then, have something in 'Start' or 'Awake' which checks 'Application.loadedLevel' in the same way, for when an object is instantiated outside of level loading.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Unity 3d(Space) Questions 1 Answer
Scene changing 1 Answer
How to Set a bool to Individual Scenes (C#) 1 Answer
Editing a script 2 Answers