Skip to content

Instantly share code, notes, and snippets.

@xdegtyarev
Created October 31, 2013 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xdegtyarev/7257570 to your computer and use it in GitHub Desktop.
Save xdegtyarev/7257570 to your computer and use it in GitHub Desktop.
Tiny Editor script, to create empty game object as a child to currently selected transform.
using UnityEngine;
using UnityEditor;
public class CreateEmptyChild : MonoBehaviour {
[MenuItem("GameObject/Create Empty Child &#n")]
static void EmptyChild(){
GameObject go = new GameObject("Empty");
go.transform.parent = Selection.activeTransform;
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment