Just add this component to a game object with an animator. The object will self destroy when it reaches an animation state with name animName
(default to "Destroy").
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class DestroyOnAnimState : MonoBehaviour {
public string animName = "Destroy";
private Animator anim;
void Start () {
anim = GetComponent<Animator>();
}
void Update () {
if(anim.GetCurrentAnimatorStateInfo(0).IsName(animName)){
Destroy(gameObject);
}
}
}