- Home /
How to start animation after object is destroyed ?
So I have a dialogue and when it is finished it is destroyed. I want to start an animation after the dialogue is destroyed. So basically it is character that player talks to and when the dialogue is finished the character runs away. This running away is an animation that I want to play after the dialogue is destroyed and that it would be once.
I have tried and failed, I dont understand why. Example: (I know it is collider, but even this doesnt work, I have placed this as component for the colider)
public class PlayMyAnimation : MonoBehaviour
{
public Animator animator2;
private void OnTriggerEnter(Collider other)
{
if (other.name == "Player")
{
animator2.SetBool("PlayRun", true);
}
}
}
Comment
Ok, I noticed, that one is public and the other one is private. Still just looking how to start animation after the dialogue is destroyed