-
-
Save kirillrybin/6736245 to your computer and use it in GitHub Desktop.
Create nested Child Gameobject in selected transform.
This file contains 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 Child : MonoBehaviour { | |
[MenuItem ("GameObject/Create Child #&n")] | |
static void DoSomething () { | |
if (Selection.activeTransform){ | |
var go = new GameObject(); | |
go.name = "Child"; | |
go.transform.parent = Selection.activeTransform; | |
go.transform.localPosition = Vector3.zero; | |
go.transform.localRotation = Quaternion.identity; | |
go.transform.localScale = new Vector3(1,1,1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment