Hello. When I activate an object through a script like this, how can I make sure that all of the object’s children are also activated (and vice versa for deactivating it)? Also, how can I make an exception to this (ex: an object has 5 children, and I want to activate 4 of them)? Thanks
To activate/deactivate selectively, you’ll probably just have to do it manually. Note that you can iterate over all the (first-level) children of an object by iterating over its transform (see the docs on Transform for details) which might help. And, of course you can use any of the usual means of referencing an object for the purpose of activating/deactivating it, or of reactivating it or re-deactivating it after using SetActiveRecursively() to activate/deactivate a game object and its children.
Hmmm, it appears that the script is not being called. I am using a toolbar script in a menu scene to determine the options for my game(a bit of that script is below). That then affects the static variable in the other script(“_Options”), which then affects which objects are active. For some reason, the toolbar script wont affect the _Options script. The toolbar script works if it is affecting static variables (I tested it using my games score). Any ideas?
static var GenreInt = 0;
function OnGUI() {
GenreInt = GUI.Toolbar (Rect (240, 200, 500, 50), GenreInt,
["Classic", "Defender", "Vertical","Twin Stick"]);}
function Update (){
if (Arcade.GenreInt ==0) {_Options.Genre =1;}}
I got it. I figured out how to affect the variables in the other script. I needed to have an in between script that used DontDestroyOnLoad. So it goes GUI Script>Mid Script>Options>Turn objects on/off. But, the objects still will not turn on/off