Hello,
I have a bug where Enemy just freezes on the first waypoint.
If I change Vector 2 to Vector 3 in my code, as I read on the forum, the enemy moves properly on Scene view, but vanishes from Game view. I checked all “Z” axises and they seem to be correct (Paths and Waypoints are on the same “Z” axis).
There are no errors in console. Unity: 2019.3.7f1
Any thoughts? I am not even sure what other details to share, as I am pretty sure my code is correct.
Wave Config:
public List<Transform> GetWaypoints()
{
var waveWaypoints = new List<Transform>();
foreach (Transform child in pathPrefab.transform)
{
waveWaypoints.Add(child);
}
return waveWaypoints;
}
Enemy Pathing:
[SerializeField] WaveConfig waveConfig;
List<Transform> waypoints;
[SerializeField] float moveSpeed = 2f;
int waypointIndex = 0;
void Start()
{
waypoints = waveConfig.GetWaypoints();
transform.position = waypoints[waypointIndex].transform.position;
}
Regards,
Pawel