You can assume my project is left-right Tower Defense.
so allies can pass thru, but when its in front of enemy it stops and attack
all pics taken from google. just don't want to reveal our game arts.
on my Player Object, I have 2 BoxCollider2D. one to check collision, and one is a trigger (the X size is double) to make enemy stops and attack when it enters the trigger. picture will make it clearer.
on the enemy Object, theres a BoxCollider2D, and it has a sword(child) with PolygonCollider2D(trigger)
then I use Trigger Event on the enemy when it touch player trigger area.
But it wouldn't work without rigidbody2D attached. After I attach rigidbody2D, I think I've accomplished a problem... but when I try to spawn them continuously, this happens.
how could you play Tower Defense if the enemy wave is politely queue-ing to attack
and the performance get really bad. below 20FPS. I've read somewhere that trigger stay will be a performance hit.
so can anyone here help me?