So got this error because made everything like in the video.
And then followed to the lectures commit and found out the fix of this error.
But still i would like to understand, the source of this error.
So in the video we refactor our EnemyMover.
Here is the refactor from the video:
void FindPath()
{
path.Clear();
GameObject parent = GameObject.FindGameObjectWithTag("Path");
foreach(Transform child in parent.transform)
{
Waypoint waypoint = child.GetComponent<Waypoint>();
if(waypoint != null)
{
path.Add(waypoint);
}
}
}
And here is the correct refactor from the commit:
void FindPath()
{
path.Clear();
GameObject[] tiles = GameObject.FindGameObjectsWithTag("Path");
foreach(GameObject tile in tiles)
{
Waypoint waypoint = tile.GetComponent<Waypoint>();
if(waypoint != null)
{
path.Add(waypoint);
}
}
}
So this issue completely messed up my understanding.
So in the video we changed our tags on the parent Path game object to tag “Path” and all the child tiles groupped inside to tag “Untagged”. And we even referred to Path game object as a parent. So now in the commit of the refactor is pretty much the same thing which we refactored. What is the point?