Exemple #1
0
 internal static void CreateEmptySibling(GameObject go, bool useEvent = false)
 {
     TransformX.xNewTransform(
         name: "New".GetNewName(go.transform, "Empty"), undo: "NewEmptySibling", p: go.transform.parent);
     //.PingAndUseEvent(false, useEvent);
     if (useEvent)
     {
         Event.current.Use();
     }
 }
Exemple #2
0
    ///----------------------------------- CREATE GO -------------------------------------------
    internal static void CreateEmptyChild(GameObject go, bool useEvent = false)
    {
        //var willPing = go.transform.childCount == 0 || !go.IsExpanded();

        TransformX.xNewTransform(name: "New".GetNewName(go.transform, "Empty"), undo: "NewEmptyChild", p: go.transform);
        //.PingAndUseEvent(willPing, useEvent);

        if (useEvent)
        {
            Event.current.Use();
        }
    }
Exemple #3
0
    internal static void CreateParentAtOrigin(GameObject go, bool useEvent = false)
    {
        Selection.activeGameObject = go;
        var goT = go.transform;
        var p   = TransformX.xNewTransform(
            name: "NewEmpty".GetNewName(goT.parent, "_parent"), undo: "NewParent2", p: goT.parent);

        goT.xReparent("NewParent2", p);
        //p.gameObject.RevealChildrenInHierarchy();
        //p.Ping();
        if (useEvent)
        {
            Event.current.Use();
        }
    }
Exemple #4
0
    internal static void CreateParentAtMyPosition(GameObject go, bool useEvent = false)
    {
        Selection.activeGameObject = go;
        var goT = go.transform;
        var p   = TransformX.xNewTransform(
            name: "NewEmpty".GetNewName(goT.parent, "_parent"), undo: "NewParent1", p: goT.parent,
            pos: goT.localPosition, scl: goT.localScale, rot: goT.localEulerAngles);

        goT.xReparent("NewParent1", p);
        //p.gameObject.RevealChildrenInHierarchy();

        if (useEvent)
        {
            Event.current.Use();
        }
    }