///Duplicate the track in this group public CutsceneTrack DuplicateTrack(CutsceneTrack track) { if (track == null || track.GetType().RTGetAttribute <UniqueElementAttribute>(true) != null) { return(null); } var newTrack = (CutsceneTrack)Instantiate(track); UnityEditor.Undo.RegisterCreatedObjectUndo(newTrack.gameObject, "Duplicate Track"); UnityEditor.Undo.SetTransformParent(newTrack.transform, this.transform, "Duplicate Track"); UnityEditor.Undo.RegisterCompleteObjectUndo(this, "Duplicate Track"); newTrack.transform.localPosition = Vector3.zero; tracks.Add(newTrack); root.Validate(); CutsceneUtility.selectedObject = newTrack; return(newTrack); }
///---------------------------------------------------------------------------------------------- ///---------------------------------------UNITY EDITOR------------------------------------------- #if UNITY_EDITOR ///Can track be added in this group? public bool CanAddTrack(CutsceneTrack track) { return(track != null?CanAddTrackOfType(track.GetType()) : false); }