标签:c style class blog code java
using UnityEngine; using UnityEditor; using System.Collections; public class AddParent : ScriptableObject { [MenuItem ("GameObject/+Add Parent")] static void MenuInsertParent() { Transform[] transforms = Selection.GetTransforms(SelectionMode.TopLevel | SelectionMode.OnlyUserModifiable); GameObject newParent = new GameObject("_Parent"); Transform newParentTransform = newParent.transform; if(transforms.Length == 1) { Transform originalParent = transforms[0].parent; transforms[0].parent = newParentTransform; if(originalParent) newParentTransform.parent = originalParent; } else { foreach(Transform transform in transforms) transform.parent = newParentTransform; } } }
标签:c style class blog code java
原文地址:http://www.cnblogs.com/softimagewht/p/3765397.html