toggle set active recursively

Hi guys

Can someone please shed some light on this for me. At the moment this code gives me an error that “expressions cannot be assigned”.

myToggle = (GUI.Toggle (Rect(115,180,110,30), myToggle, "THIS", "button"));
	     Stuff.SetActiveRecursively(!Stuff.active) = myToggle;

The code below does work, but doesn’t do what I need, ie the recursive bit.

myToggle = (GUI.Toggle (Rect(115,180,110,30), myToggle, "THIS", "button"));
	     Stuff.active = myToggle;

Any ideas? Thanks

My guess is you can’t assign “myToggle” to the SetActiveRecursively function.

Whereas in the working example, you assign “myToggle” to the Stuff.active property, which you can assign.

I’m not sure what you’re trying to accomplish, but you could try:

myToggle = (GUI.Toggle (Rect(115,180,110,30), myToggle, "THIS", "button")); 
Stuff.SetActiveRecursively(myToggle);

Which will set the active flag of the Stuff object and all of its childs to the value of “myToggle”

Thanks nvarcha

That’s great! Problem Solved.