LaserDefender Pathing Problem


im having a problem with the pathing in LaserDefender, ive spent several hours looking through the project, trying things, but i cant seem to find the problem.

It DID work perfectly, i have NOT changed any scripts, so i am 100% sure the problem is not there.

The enemies get spawned like theyre supposed to at the first waypoint child.
The enemies just stay on their initial spawn position, and dont move towards the next waypoint.
Everything else works, they shoot, i can destroy them etc.

I have tried making new waveconfigs, paths, enemies. but the problem remains

You should post details, screen, code something.

Hi RustyNail,

We believe you if you write that you had checked everything. However, nobody is perfect, and that’s fine. Please share your code anyway even if you are 100% sure that there is no problem. The more we know about your project, the more likely it is that we will be able to assist you.

What you describe sounds like a typical problem, so maybe this will fix the issue for you: Make sure that the z-position of the waypoints (and their parent game object) are set to 0.

Alternatively, try to replace Vector2.MoveTowards with Vector3.MoveTowards in the EnemyPathing class.

See also:

1 Like

Hi, thanks for the fast replies, i was indeed hoping i missed something and the problem would be clear to one that knows more than i do at this point, and so you did! thanks.
The movement and spawn scripts are all exactly as the course for now, i also didnt get any errors in the console.

I did indeed change some things with the Z pos, my player, enemies, path parent were all on 3,
else i didnt see them over the background. i assumed it would work if they were all on the same height. It did for a while, thinking back i guess broke when i mass applied the scene changes to their prefabs.
After making more interesting paths. Ofc all the new things i tried, i also set the Z to the same as the player… so turns out i just kept reproducing my problem.

Both of your things solved the problem, first i changed to a vector3 and that fixed it,
then back to a vector2 and set all the paths to 0 and it works too

From the course i understood that height only matters for visibility, but i guess also for vectors then.
I will keep this in mind in the future!

Thanks alot!! :smiley:

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

Privacy & Terms