So i have health bar everything set up no errors occur but the enemy Ai i have set up once he hits zero dosn’t play his death animation, from the code i used it should so im unsure whats problem is. code below is what detects the hits, his health bar does go down so i know i am hitting him correctly just health.
sing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DetectHit : MonoBehaviour {
public Slider heatlhbar;
Animator anim;
private void OnTriggerEnter(Collider other)
{
heatlhbar.value -= 30;
}
// Use this for initialization
void Start () {
anim = GetComponent<Animator>();
if (heatlhbar.value <= 0)
{
anim.SetBool("isDead", true);
}
}
// Update is called once per frame
void Update () {
}
}