Engaged lizards immune to projectiles

Everything is acting as I would expect, except that any lizard that is attacking a target is immune to projectiles – they pass right through.

I imagine this is because their collider is already triggered by the object they are attacking, but I don’t know if I am right or what to do about it.

Hi,

Have you already tried to add Debug.Logs to your code to see what is going on during runtime? If the method does not get called at all, check the spelling of the method name. If the spelling is correct, check the collider settings of both the Lizard and the projectiles. If in doubt, please share screenshots.

The projectile is hitting the trophy object, which has no health (yet) and not triggering at the subsequent hit on the lizard. I will try using layers to see what I can do, but I don’t know why the lesson isn’t having the same problem. I tried taking off and putting on RigidBody2D on the trophy, projectile and lizard, but no success.

EDIT: No, that didn’t work. The projectile now doesn’t interact with the trophy, but it still ignores the attacking lizard. It is like once it starts using the attack animation, it stops having a collider.

EDIT2: Fixed it. Totally embarrassing. Way back in the lessons I didn’t like that a stray projectile could kill the lizards as they were gating in, so I modified the collider with animation events. This was an artifact of that.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms