If there only is 1 lizard spawn when it reach a defender the lizard stop and start attacking the defender. But when I spaw 2 lizards and the first reach a defender it will continue to walk and the seconde lizard will stop and start the attacking animation.
Hi Jonas,
Welcome to our community!
Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture? Make sure that the code of the Lizard does not accidentally call FindObjectOfType when it is supposed to call GetComponent. Also check the size of the colliders. They must not overlap “wrong” lanes.
If you cannot find a problem, try to set the Sleep Mode of the Lizard’s Rigidbody2D component to “Never Sleep”. In some cases, the Rigidbody2D components gets set to “sleep” during runtime, and the Lizard suddenly does not collide with anything anymore.
Did this help?
See also:
- Forum User Guides : How to mark a topic as solved
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.