Hey Rick,
I have so far enjoyed the class immensely, it is very informative and useful. I admit to not paying full attention in the beginning like many students and starting the course on Unity 2018.3+, this has lead to some pretty substantial issues throughout the course. I found a strange workaround that you may want to add to the end of this section for people who made the same mistake I did. If you leave the " waveConfig "and “waypoints” lists serialized as listed below (in the EnemyPathing.cs Script), you don’t get the issue that doesn’t allow your instantiated enemies to move.
using System.Collections.Generic;
using UnityEngine;
public class EnemyPathing : MonoBehaviour
{
//connecting the script for which wave we are dealing with to the enemy pathing script.
[SerializeField] WaveConfig waveConfig; //IF YOU LEAVE THIS SERIALIZED IN THE MORE UP TO DATE VERSIONS OF UNITY, IT WON'T CAUSE SOME OF THE ISSUES
[SerializeField] List<Transform> waypoints; //IF YOU LEAVE THIS SERIALIZED IN THE MORE UP TO DATE VERSIONS OF UNITY, IT WON'T CAUSE SOME OF THE ISSUES
int waypointIndex = 0;
// Start is called before the first frame update
void Start()
{
transform.position = waypoints[waypointIndex].transform.position;
}
// Update is called once per frame
void Update()
{
Move();
waypoints = waveConfig.GetWayPoints();
}
public void SetWaveConfig(WaveConfig waveConfig)
{
this.waveConfig = waveConfig;
}
private void Move()
{
if (waypointIndex <= waypoints.Count - 1)
{
var targetPosition = waypoints[waypointIndex].transform.position;
var movementThisFrame = waveConfig.GetMoveSpeedOfEnemies() * Time.deltaTime;
transform.position = Vector2.MoveTowards
(transform.position, targetPosition, movementThisFrame);
if (transform.position == targetPosition)
{
waypointIndex++;
}
}
else
{
waypointIndex = 0;
}
}
}