public void CopyTo(AnimationPlaylistItem state) { state.name = this.name; state.loopCount = this.loopCount; state.finishCallback = this.finishCallback; state.isEnable = this.isEnable; }
void PlayNextAnimation() { item = queue.Dequeue(); if (item == null) { return; } animator.Play(item.hashName, -1, 0); currentHashName = item.hashName; }
public override void OnInspectorGUI() { AnimationPlayer ap = target as AnimationPlayer; ap.playOnStart = EditorGUILayout.Toggle("PlayOnStart", ap.playOnStart); ap.isRepeatPlay = EditorGUILayout.Toggle("IsRepeatPlay", ap.isRepeatPlay); EditorUtility.SetDirty(target); serializedObject.Update(); list.DoLayoutList(); List <AnimationPlaylistItem> appendItems = new List <AnimationPlaylistItem>(); if (GUILayout.Button("Update Animation Playlist")) { // delete files var animatorStates = GetAnimatorStateList(ap.GetComponent <Animator>()); AnimationPlaylistItem[] copied = new AnimationPlaylistItem[ap.playlist.Count]; ap.playlist.CopyTo(copied); ap.playlist.Clear(); for (int i = 0; i < animatorStates.Count; i++) { var state = animatorStates[i]; for (int j = 0; j < copied.Length; j++) { if (state.name.Equals(copied[j].name)) { copied[j].CopyTo(state); break; } } appendItems.Add(state); } } ap.playlist.AddRange(appendItems); serializedObject.ApplyModifiedProperties(); }