GameObject B does not collide with GameObject A

Hello guys,

I have a 2D game where A attacks B and then B attacks A (turn-based). A attacking B works fine, but B attacking A has issues - read the issue part for explanation.

MY ISSUE:

GameObject A walks towards GameObject B. It collided with B normally and performs action OnTriggerEnter. Now the same thing should occur with GameObject B. GameObject B walks towards GameObject A. It DOES NOT collide where the actual boundaries of BOX COLLIDER are (both use two Box Colliders, one for actual collision, other one for IsTrigger events). But it stops in the middle of GameObject A, crashing to it for few times and stops.

BoxCollider boundaries are set OK. Even if I make them bigger, the first scenario (A → B) works as expected (will stop even sooner, because of bigger collider on B), but vice versa (B → A) won’t work and same scenario happens (B will walk to center of A and keep hitting to that point few times and stop).

SCENARIO:

94093-scenario.png

I don’t know what I am doing wrong. I think I might be missing something related to 2D Physics of using BoxColliders.

Could you post your code for the two GameObjects please, I think I had the same issue in the past @David92

Are you using Rigidbody2D? I believe this component should be added to both objects. It looks like your issue might occur because Game Object B doesn’t have Rigidbody2D.