Toolbar help.

Hello. I am using toolbars for the options menu in my game (difficulty, ship, etc.). How can I make it so that when a button is active, it activates a component in the NEXT scene? I could try to use “do not destroy on load” but that would also keep the GUI elements on the screen. Any ideas? Thanks.

You’ll need to track the state of the toolbar somewhere else, and use ‘do not destroy on load’ on the object that holds the state, instead of the object that holds the GUI script. In other words, in your GUI code, store the state information that the next scene needs to look at in a script on another object, which persists after the level load.

How can I do that? I have tried

static var ModeInt = 0;
var ModeStrings : String[] = [];

function OnGUI() {
	ModeInt = GUI.Toolbar (Rect (240, 270, 500, 50), ModeInt, ModeStrings);
}

function Update(){
if (ModeStrings==2) ArcadeOptions.Mode == 2;
}

and it does not work (with this I get no errors but nothing happens. If I change ArcadeOptions.Mode == 2 to ArcadeOptions.Mode =2 and I get the error “Assets/Scripts/Menu/Arcade.js(33,50): BCE0022: Cannot convert ‘int’ to ‘System.Type’.”

You definitely want the = (assignment) operator, not the == (equality test) operator. You don’t show the declaration of ArcadeOptions.Mode but, given the error, I assume it’s not an ‘int’ value…

Yep, we explained that and the System.Type error in the other thread where he posted the same code:

http://forum.unity3d.com/threads/70337-I-need-help-with-my-script

I know that I need only one equal sign, my problem is that I do not know how to deal with the error I get.

To quote myself from the other thread:

And:

I fixed those errors in my updated script here, bit it is still not working the way I want it to
http://forum.unity3d.com/threads/70337-I-need-help-with-my-script