Complete C# Unity Game Developer 2D I am stuck on the laser defender project

Hi I am doing the Complete C# Unity Game Developer 2D course on Udemy. I am on the last project Laser Defender and am stuck. I am trying to make a enemy follow waypoints.
This code is supposed to make the enemy move between the waypoints I created.

This code is for getting the locations of the waypoints.

This is what the enemy I want to make move looks like in the inspector.

This is the prefab of the waypoints.

This is the scriptable object made in the waveConfig script.

Right now when I press play the enemy teleports the the top of the screen and then stays there. Also I am pretty sure I previously had a waypoint where the enemy is teleporting but am pretty sure I moved it.
Thank you in advance for responding.

I just tested this (with effort because I can’t copy and paste from a screenshot) and it works fine for me.

I do notice that your prefab is not at position (0,0). This could cause issues because the waypoint positions are local and when you get them from the SO, you will get world positions. That is, if a waypoint is at position (10, 10) but the prefab position is at (5,5) your enemy will move to position (15,15).

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms