ToggleActiveRecursively

From Unify Community Wiki
Revision as of 03:32, 1 July 2006 by Aarku (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Author: Jonathan Czeck (aarku)

Description

This editor script takes the current object selected in your hierarchy and toggles whether or not it is active. Then it sets the activeness of all its children to this.

Usage

Place this script in YourProject/Assets/Editor and a menu item will automatically appear in the Custom menu after it is compiled.

C# - ToggleActiveRecursively.cs

<csharp>using UnityEngine; using UnityEditor;

public class ToggleActiveRecursively : ScriptableObject {

   [MenuItem ("Custom/Toggle Active And Send Recursively %i")]
   static void DoToggle()
   {
       GameObject activeGO = Selection.activeGameObject;
       
       activeGO.SetActiveRecursively(!activeGO.active);
   }

}

</csharp>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox