Created
April 21, 2015 12:53
-
-
Save romainPechot/80baca0ecde766a12526 to your computer and use it in GitHub Desktop.
An Unity editor tool shortcut to quickly de-activate the gameObject(s) selected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class SetActiveGameObject : Editor | |
{ | |
[MenuItem("Tools/On-Off GameObject %g")] | |
private static void EnableDisableGameObject() | |
{ | |
// fetch | |
GameObject[] _aGO = Selection.gameObjects; | |
// save undo | |
Undo.RecordObjects(_aGO, "de-activate gameObject(s)"); | |
// switch state | |
for(int i = 0; i < _aGO.Length; i++) _aGO[i].SetActive(!_aGO[i].activeSelf); | |
}// EnableDisableGameObject | |
}// SetActiveGameObject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment