Skip to content

Instantly share code, notes, and snippets.

@nicoplv
Created August 25, 2017 09:58
Show Gist options
  • Save nicoplv/26fd017200fd638439f57dfd15ed4d32 to your computer and use it in GitHub Desktop.
Save nicoplv/26fd017200fd638439f57dfd15ed4d32 to your computer and use it in GitHub Desktop.
Group maker for Unity Editor
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;
}
}
}
}
@ShapeGroup
Copy link

Interesting and tested idea. The positioning of the pivot should be adjusted ... have you tried to average the positions of the grouped objects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment