Last active
November 16, 2023 11:39
Revisions
-
raisilhamn revised this gist
Nov 30, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,5 +18,7 @@ public static class GroupCommand } ``` Save this in Assets/Editor/GroupCommand.cs Use 'Ctrl-G' or 'GameObject Menu > Group Selected'. It also supports Undo: Thanks to bjennings76 = https://answers.unity.com/questions/118306/grouping-objects-in-the-hierarchy.html -
raisilhamn created this gist
Nov 30, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ Not my script. Just personal note ```cs using UnityEditor; using UnityEngine; public static class GroupCommand { [MenuItem("GameObject/Group Selected %g")] private static void GroupSelected() { if (!Selection.activeTransform) return; var go = new GameObject(Selection.activeTransform.name + " Group"); Undo.RegisterCreatedObjectUndo(go, "Group Selected"); go.transform.SetParent(Selection.activeTransform.parent, false); foreach (var transform in Selection.transforms) Undo.SetTransformParent(transform, go.transform, "Group Selected"); Selection.activeGameObject = go; } } ``` Save this in Assets/Editor/GroupCommand.cs Use 'Ctrl-G' or 'GameObject Menu > Group Selected'. It also supports Undo: Thanks to bjennings76 = https://answers.unity.com/questions/118306/grouping-objects-in-the-hierarchy.html