- Home /
Other fixed issue by myself
Why is my enemy only working on certain scenes?
On a few of my scenes in my game, my enemy character will play an animation on the condition that my character is invulnerable. However, this only works on a few scenes for some reason and on the other scenes, it doesn't work at all. The Debug.Log("Staggered") doesn't show in the console which leads me to believe that the function isn't getting called but because it is in the Update method, I don't know how to fix a problem like this. I would appreciate and help on how I can get everything to be called correctly.
void Update()
{
GameObject love = GameObject.Find("Knight");
PlayerHealth playerHealth = love.GetComponent<PlayerHealth>();
Debug.Log(animator.GetBool("Attack"));
if(playerHealth.isInvulnerable == true){
animator.SetTrigger("Hurt");
Debug.Log("Staggered");
}
}
Follow this Question
Related Questions
On Collide Destroy Game Object 2 Answers
Enemy following Player on uneven surface 1 Answer
Suggestions for AI Selecting From Multiple Targets? 3 Answers
add waypoint to transform[] 2 Answers
Unity 3D enemy stop distance? 1 Answer