Created
July 16, 2013 14:15
-
-
Save dbuck/6009100 to your computer and use it in GitHub Desktop.
Editor code snip to replace the CreateEmpty gameobject function with one that will always show up as the child of the currently selected game object.
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
| [MenuItem("GameObject/Create Empty %#n", priority = -1)] | |
| static void menu_GameObject_CreateEmpty() | |
| { | |
| //Debug.Log("menu_GameObject_CreateEmpty"); | |
| Undo.RegisterSceneUndo("Create Empty"); | |
| GameObject go = new GameObject("GameObject"); | |
| go.transform.parent = Selection.activeTransform; | |
| go.transform.localPosition = Vector3.zero; | |
| go.transform.localRotation = Quaternion.identity; | |
| go.transform.localScale = Vector3.one; | |
| Selection.activeObject = go; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment