Dead Animation
- Add the Target.cs script on to the character
- Add the animation to the controller
- Animations are available for free on Mixamo
- Add the following code to the character behavoir/movement script (so the character will stop moving if it's dead)
private Target targetScript;
void Start(){
targetScript = GetComponent<Target>;
}
void Update()
{ // Check if the targetScript is not null and if the health is <= 0
if (targetScript != null && targetScript.health <= 0f)
{
// Stop agent movement
agent.isStopped = true;
return; // Stop the update method because the enemy is dead
}
}