- Home /
Help with making a script in the unity editor
This is what I am doing now:
click on an active gameobject in my scene.
moving my mouse to the inspector and clicking on the tick that corresponds to the setActive function
As a result, the gameobject is now inactive.
However, this is a pain to do when you have dozens of gameobjects. I would rather use a shortcut key:
click on an active gameobject in my scene.
press a shortcut key (such as alt+a) which makes the selected gameobject inactive.
As a result, the gameobject is now inactive
It looks like this can help: http://docs.unity3d.com/ScriptReference/MenuItem.html http://docs.unity3d.com/ScriptReference/Selection.html
I am not exactly sure where to place my script or what to include in it.
Answer by emc233 · Jan 14, 2015 at 04:16 AM
http://unity3d.com/learn/tutorials/modules/intermediate/editor/menu-items
This is exactly what I was looking for. It is a very clear tutorial
Answer by Taxen0 · Jan 12, 2015 at 10:04 AM
if you have a script attached to the object you could add:
gameObject.SetActive(false);
in the awake / start method to disable it, if you set it to true it will enable itself again.
That's not what I wanted. Thats even less convenient and does not include a shortcut key.
depends on the object, if it is a prefab that you know always should be disabled it saves you time. or if you instantiate it from another script it can be used right after.
sorry its not what you where after, for shortcuts simply read the manual.