Answers for "how to make gameobject destroy after animation"

C#
1

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
Posted by: Guest on June-22-2021
0

destroy the game object if the animator has finished its animation

// destroy the game object if the animator has finished its animation
		if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1)
        {
			Destroy(gameObject);
		}
Posted by: Guest on August-12-2021

Code answers related to "how to make gameobject destroy after animation"

C# Answers by Framework

Browse Popular Code Answers by Language