destroy after animation unity
public class DestroyOnExit : StateMachineBehaviour { public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Destroy(animator.gameObject, stateInfo.length); }}
//for more info: https://answers.unity.com/questions/670860/delete-object-after-animation-2d.html