using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Events;
[ExecuteInEditMode]
public class AnimationCamera : MonoBehaviour
{
public string test;
public Camera animationCamera;
public Camera mainCamera;
private Animator _anim;
public UnityEvent UpdateEvent;
public List<AnimationClip> animations = new List<AnimationClip>();
private void Start()
{
animationCamera.enabled = false;
mainCamera.enabled = true;
_anim = GetComponent<Animator>();
}
private void Update()
{
if (_anim == null)
_anim = GetComponent<Animator>();
foreach (AnimationClip ac in _anim.runtimeAnimatorController.animationClips)
{
if (!animations.Contains(ac))
{
animations.Add(ac);
}
}
}
}
In this script i add item/s to the List according to change i’m doing in the Animator window in the editor.
If i add more animation clips to the Animator window it will add them to the animations List.
But now i want also to check in a case i removed animation from the Animator window how can i update the animations list by removing the item/s i removed from the Animator window ?
Now i’m doing only a check in case i need to add a new item/s but i need to check also removing.