Created
August 25, 2017 09:58
-
-
Save nicoplv/26fd017200fd638439f57dfd15ed4d32 to your computer and use it in GitHub Desktop.
Group maker for Unity Editor
This file contains hidden or 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 UnityEditor; | |
using UnityEngine; | |
namespace SmartEditor | |
{ | |
public class GroupUtility : Editor | |
{ | |
[MenuItem("Edit/Group %g", false, 0)] | |
public static void Group() | |
{ | |
GameObject group = new GameObject("Group"); | |
if (Selection.gameObjects.Length > 0) | |
{ | |
Undo.RegisterCreatedObjectUndo(group, "Group"); | |
foreach (GameObject iGameObject in Selection.gameObjects) | |
Undo.SetTransformParent(iGameObject.transform, group.transform, "Group"); | |
Selection.activeGameObject = group; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting and tested idea. The positioning of the pivot should be adjusted ... have you tried to average the positions of the grouped objects?