ToggleActiveRecursivelyAllGameObjects

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "<javascript>" to "<syntaxhighlight lang="javascript">")
m (Text replace - "</javascript>" to "</syntaxhighlight>")
 
Line 27: Line 27:
 
}
 
}
 
}
 
}
</javascript>
+
</syntaxhighlight>
  
 
[[Category:Editor Scripts]]
 
[[Category:Editor Scripts]]
 
[[Category:ScriptableObject]]
 
[[Category:ScriptableObject]]
 
[[Category:JavaScript]]
 
[[Category:JavaScript]]

Latest revision as of 20:53, 10 January 2012

Author: Martin Schultz (MartinSchultz)

Contents

[edit] Description

This little helper scripts toggles the active status of all selected game objects to the opposite and does as well for any linked children of the selected game objects, so a full recursive active toggle for all selected GOs.

The script can be found under the menu Custom→Toggle Active All Active Selected GO's.

[edit] Usage

You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

Select some game objects and call select this script from the menu. It will toggle the active state instantly.

[edit] Screenshot

Toggleactivego.jpg


[edit] JavaScript - ToggleActiveAllSelectedGO.js

@MenuItem ("Custom/Toggle Active All Selected GO's")
static function ToggleAllSelected() {
	for (t in Selection.transforms) {
		t.gameObject.SetActiveRecursively(! t.gameObject.active);
	}
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox