i already done it my problem is the component is being disabled before the animation is done i have separate scripts by the way so here’s the code
here’s the first code this code is for the animation for my character
private void HandleAnswer(int answer) {
if (answer == 1)
{
//handle correct answer
ShowIncorrect = false;
ShowCorrect = true;
Poop = false;
animation.PlayQueued ("Wrong answer",QueueMode.PlayNow);
Enemy.animation.PlayQueued("ENMattck", QueueMode.CompleteOthers);
Attack();
NextQuestion();
}
else {
ShowIncorrect = true;
ShowCorrect = false;
Poop = false;
animation.PlayQueued ("Wrong answer",QueueMode.PlayNow);
Enemy.animation.PlayQueued("ENMattck", QueueMode.CompleteOthers);
AttackSelf();
}
here’s the second code for my enemy which tells that if the enemy health is 0 the enemy will be disabled but what happens is after i push a certain button for the animation the enemy is disabled so i need a timer or something so that until the animation is done my component wont be disabled
void Update () {
if (curHealth <= 0) {
PlayerPrefs.SetInt("SavedLevel1", 1);
Debug.Log("SavedLevel = 1");
Enemy.gameObject.SetActive(false);
}