Dev Day 67: Fixing A GameObject Detection Bug in Unity3D

Objective: Fix a bug that causes the Enemy to detect and evade laser shots after a collision that triggers the explosion animation.

Step 1: In the Enemy script, within the DodgeLeft() coroutine, add to the while loop condition that both _collider1 and _collider2 must be enabled for the evade movement to take place.

Step 2: Within the same coroutine, under the while loop, add an if statement stating that if either _collider1 or _collider2 is disabled (which occurs when the Enemy collides with a laser or the Player), stop the coroutine.

Step 3: Add the same conditions and if statement to the DodgeRight() coroutine.

Now, when the Enemy collides with the Player or laser and the explosion animation begins, the DodgeLeft() and DodgeRight() coroutines will be disabled.