internal static void PasteGOAsChild()
        {
            Transform[] selected = Selection.transforms;

            // paste as a child if a gameObject is selected
            if (selected.Length == 1)
            {
                Scene subScene        = new Scene();
                bool  pasteToSubScene = false;
                bool  isSubScene      = false;

                // If target is subScene make sure we just move objects under subScene
                if (SubSceneGUI.IsSubSceneHeader(selected[0].gameObject))
                {
                    subScene        = SubSceneGUI.GetSubScene(selected[0].gameObject);
                    isSubScene      = subScene.isSubScene;
                    pasteToSubScene = subScene.IsValid();
                }

                // handle paste after cut
                if (CutBoard.hasCutboardData)
                {
                    if (pasteToSubScene)
                    {
                        if (subScene.handle != 0)
                        {
                            CutBoard.PasteToScene(subScene, selected[0]);
                            pastedGameObjects?.Invoke(Selection.gameObjects);
                        }
                    }
                    else if (!isSubScene)
                    {
                        CutBoard.PasteAsChildren(selected[0]);
                        pastedGameObjects?.Invoke(Selection.gameObjects);
                    }
                }
                // paste after copy
                else if (pasteToSubScene || !isSubScene)
                {
                    Unsupported.PasteGameObjectsFromPasteboard(selected[0], pasteToSubScene ? subScene.handle : 0);
                    pastedGameObjects?.Invoke(Selection.gameObjects);
                }
            }
            RepaintHierarchyWindowsAfterPaste();
        }
Ejemplo n.º 2
0
        internal static void PasteGOAsChild()
        {
            Transform[] selected = Selection.transforms;

            // paste as a child if a gameObject is selected
            if (selected.Length == 1)
            {
                // handle paste after cut
                if (CutBoard.hasCutboardData)
                {
                    CutBoard.PasteAsChildren(selected[0]);
                }
                // paste after copy
                else
                {
                    Unsupported.PasteGameObjectsFromPasteboard(selected[0]);
                }
            }
            RepaintHierarchyWindowsAfterPaste();
        }