Ejemplo n.º 1
0
        private static bool WarnTransformType(Transform[] targets)
        {
            if (GroupUtility.InferTransformType(targets) == null)
            {
                EditorUtility.DisplayDialog("Cannot group objects", "Cannot create a group containing both Transforms and RectTransforms.", "OK");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static void Ungroup(Transform target)
        {
            if (!TransformOperations.WarnRestructurable(target))
            {
                return;
            }

            var ungrouped = GroupUtility.Ungroup(target);

            Selection.objects = ungrouped.Select(t => t.gameObject).ToArray();
        }
Ejemplo n.º 3
0
        public static void GroupGlobally(Transform[] targets, string defaultName = "Group")
        {
            if (!TransformOperations.WarnRestructurable(targets))
            {
                return;
            }

            if (!WarnTransformType(targets))
            {
                return;
            }

            if (GroupNamePrompt.Prompt(out var name, defaultName))
            {
                var group = GroupUtility.GroupGlobally(targets, name);
                Selection.activeTransform = group;
            }
        }