Skip to content

Instantly share code, notes, and snippets.

@stramit
Created April 23, 2013 15:20
Show Gist options
  • Save stramit/5444469 to your computer and use it in GitHub Desktop.
Save stramit/5444469 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
//Put this under a folder called Editor in your project
public class EmptyGOCreator
{
[MenuItem ("GameObject/Create Empty at level %g")]
static void CreateEmptyGOAtLevel ()
{
var go = new GameObject("GameObject");
go.transform.parent = Selection.activeGameObject == null ? null : Selection.activeGameObject.transform.parent;
go.transform.position = Vector3.zero;
}
[MenuItem ("GameObject/Create Empty below level %k")]
static void CreateEmptyGOAsChild()
{
var go = new GameObject("GameObject");
go.transform.parent = Selection.activeGameObject == null ? null : Selection.activeGameObject.transform;
go.transform.position = Vector3.zero;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment