When I place a trophy in the game field, not only does the lizard in that lane stop to eat it, the one in the lane above does also. This only happens with the trophy, not the other objects. I have checked the collider and it is small and tight around both the trophy and the lizard. Any ideas of other things to check?
Hi,
Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture? Have you already tried to add Debug.Logs to your code to see what is going on during runtime?
Make sure that the collider of the trophy is not too small. A tiny collider is easy to miss in the physics simulation. And the collider must not overlap the lane above because, otherwise, the attackers in the line above would collide with it and attack the trophy.
If the attackers in the lane above stop just because one of the attackers attacks something, there might be an issue with a reference. Make sure the code does not call FindObjectOfType instead of GetComponent.
Hopefully, this helped.
See also:
- Forum User Guides : How to mark a topic as solved
Thanks,
It turns out that I checked the colliders on the body but not on the parent. (Not sure there needs to be colliders on both, but there is.) The collider on the body was too big. Sigh.
Thanks again.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.