Just wanted to note two things I noticed that lost me an hour in debugging:
-
A caution: I made the bonehead mistake of adding the ‘Pathfinder’ script to the enemy sprite nested within the Enemy Prefab, rather than on the parent object. While the enemy sprite was following the path as expected, the game object position was never changing, which was triggering collisions between the enemies as new ones spawned in.
-
A potential bug: If your time between spawn is too low or if your path has loops, the Enemy ships may collide with one another and immediately be destroyed. I created an ‘Enemy’ layer and adjusted the Physics 2D matrix under Project Settings so that game objects on the enemy layer could not collide with themselves. I’m guessing this will be addressed in later videos, but this caught me off guard.