Enemies immediately destroyed at first waypoint

Hello! I actually came from a lecture or two later from this one, but this section of Laser Defender lectures is where my progress slowed quite a bit. I encountered a bug after the lecture Move Enemy On Path and onward where my enemies appear for a split second and disappear, while not moving from the starting waypoint. I tried everything from doing all the code from this section again, double checking every script and prefab, and resetting the transform, but it doesn’t change. Please help

Hi Jawile,

Welcome to our community! :slight_smile:

Have you also checked the parent z-position of your path as well as the children’s z-positions? They must be set to 0. The enemy’s z-position must be 0 too.

Are there any error messages in your console?

Yea they’re all 0 in the z-position, strangely there’s no error messages though.

Could the enemy destroy itself with its own laser? That’s a known issue which gets solved in the lecture named “Layer Collision Matrix”.

The enemy can’t shoot lasers yet, the last lecture I watched before asking for help was WaveConfig for Path & Speed.

Since nothing automatically destroys itself in an active scene, look for a method that destroys the enemies.

Mm only method that does this is the Move() method that destroys the enemy once it reaches the last waypoint in the index, it’s weird though because it does this action immediately at element 0 / the first waypoint.

I just tried something, I serialized the fields for the wave config and the list of waypoints and paused the game right when one of the enemies spawned before it was destroyed.
Everything looks in place besides this error in the console, something look off maybe?

To what is the warning referring? Something seems to try to access something that does not exist.

Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?

Post your code here.

This topic was automatically closed after 6 days. New replies are no longer allowed.

Privacy & Terms