Hi all,
I have a simple toolbar that I am using to load the different levels of my application; the problem I am having is that when I attach the application.loadlevel script to a specific level’s main camera, the other scripts in that given level stop functioning - however, the other levels function perfectly.
After doing some research, I thought that maybe this had to do with the execution order of the OnGUI script vs. the other Update scripts…but I don’t know. Here’s my application.loadlevel script:
var toolbarInt = 0;
var toolbarStrings : String[]= ["ReLoad", "Level 1", "Level 2", "Level 3"];
var mySkin : GUISkin;
function OnGUI () {
GUI.skin = mySkin;
toolbarInt = GUI.Toolbar (Rect (Screen.width - 300, Screen.height - 40, 290, 30), toolbarInt, toolbarStrings);
if (toolbarStrings[toolbarInt] == "ReLoad") {
Application.LoadLevel (0);
}
if (toolbarStrings[toolbarInt] == "Level 1") {
Application.LoadLevel (1);
}
if (toolbarStrings[toolbarInt] == "Level 2") {
Application.LoadLevel (2);
}
if (toolbarStrings[toolbarInt] == "Level 3") {
Application.LoadLevel (3);
}
}
Do I need to make the GUI part a coroutine (ie, make it run after the update scripts are called)? If so, how do I do this?
Thanks in advance.