Any questions or comments about triggering death animations?

This was a pretty quick, easy lecture… any questions or comments?


Before the fix. Laughed a little.

I like the decorations you’ve added. :slight_smile:

Ah, the crates. I attached Rigidbodies for realism. Enjoyed flinging them across the sandbox. :sweat_smile:

Hi! Random Q. 3 years on (no worries if it doesn’t get a reply)…

I tried writing the following if statement…

if (objectHealth == 0)
{
GetComponent().SetTrigger(“isDying”);
}

…inside the Update() method of the Health.cs.

But it didn’t work correctly.

After I’d cut/paste this if statement it into the TakeDamage() method (as instructed in the video) it worked fine. However, I’m unsure as to why this is.

What about my putting the if statement in Health.cs Update() was making it bug out?

Any light you can shed onto this would be appreciated :slight_smile:

The “isDying” trigger is from Any state. This includes the state that the trigger leads to.
So what’s happening when you put it in Update(), is it keeps going back to the beginning of the Dead state, over and over and over and over again.

Thank you for the explanation :slight_smile:

I dont know but we could just Untick the "can transition to Self " ?

That actually should work, yes. It’s still best not to set the trigger every frame.