///Delete a group from the cutscene.
        public void DeleteGroup(CutsceneGroup group)
        {
            if (group is DirectorGroup)
            {
                Debug.LogWarning("The Director Group can't be removed from the Cutscene", gameObject);
                return;
            }

            UnityEditor.Undo.RegisterCompleteObjectUndo(this, "Delete Group");
            groups.Remove(group);
            Validate();
            UnityEditor.Undo.DestroyObjectImmediate(group.gameObject);
        }
Beispiel #2
0
        ///Duplicate a group in the cutscene.
        public CutsceneGroup DuplicateGroup(CutsceneGroup group, GameObject targetActor = null)
        {
            if (group == null || (group is DirectorGroup))
            {
                return(null);
            }

            var newGroup = (CutsceneGroup)Instantiate(group);

            UnityEditor.Undo.RegisterCreatedObjectUndo(newGroup.gameObject, "Duplicate Group");
            UnityEditor.Undo.SetTransformParent(newGroup.transform, groupsRoot, "Duplicate Group");
            UnityEditor.Undo.RegisterCompleteObjectUndo(this, "Duplicate Group");
            newGroup.actor = targetActor;
            newGroup.transform.localPosition = Vector3.zero;
            groups.Add(newGroup);
            Validate();
            CutsceneUtility.selectedObject = newGroup;
            return(newGroup);
        }
Beispiel #3
0
        ///Delete a group from the cutscene.
        public void DeleteGroup(CutsceneGroup group)
        {
#if UNITY_2018_3_OR_NEWER
            if (!group.gameObject.IsSafePrefabDelete())
            {
                UnityEditor.EditorUtility.DisplayDialog("Delete Group", "This group is part of the prefab asset and can not be deleted from within the prefab instance. If you want to delete the group, please open the prefab asset for editing.", "OK");
                return;
            }
#endif

            if (group is DirectorGroup)
            {
                Debug.LogWarning("The Director Group can't be removed from the Cutscene", gameObject);
                return;
            }

            UnityEditor.Undo.RegisterCompleteObjectUndo(this, "Delete Group");
            groups.Remove(group);
            Validate();
            UnityEditor.Undo.DestroyObjectImmediate(group.gameObject);
        }