Waypoints in 2019.x not working

Hello. I’m working through the Laser Defender tutorial and everything is fine up until this lesson. As others seem to have noted there was apparently a change in Unity 2018.3 that made the waypoint and enemy pathing script not work correctly. In 2019.1.1f1 when I add either the individual waypoints or the path to the enemy pathing script and run the game my enemy completely disappears.

I’ve continued working through to the Foreach lesson based on another similar question that provided that advice, but after completing that lesson the enemy ship only appears at the 0,0,0 position then stops. If I remove the enemy’s wave config then the enemy stays where it was placed.

The Waypoint Icons also do not seem to be visible. I’ve tried the Gizmo settings, the Layers etc. as suggested in other threads but no luck. I can live without that, but having the enemy follow the waypoints seems to be a major hurdle to following this lesson. I assume I could grab an older version of Unity and follow the course, but that wouldn’t really help me going forward. Is there a way to change the code to account for the updated features in Unity 2019.x?

Thanks in advance!

Link to project: https://www.dropbox.com/s/b7bo78pjp26vajy/Ship%20Shooter.zip?dl=0

Hi Ryan,

Does the disappearing enemy remain in the Hierarchy? If so, check its position. The enemy moves only to the next waypoint if the (transform.position == targetPosition) has been evaluated to true in the EnemyPathing instance. Both the transform.position.z and targetPosition.z have to be 0.

Remember you can also look at the lecture code changes via the link in the Resources of each lecture.

Thank you, this was helpful. Looking at the code I see that my Else in EnemyPathing was connected to the wrong If. That caused the gameObject to be destroyed immediately since it was not at the target position.

I also found that I needed to set my waypoints in the prefab rather than the Game in order for the enemy to follow them. That seems to have solved both my issues.

Thank you!

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

Privacy & Terms