Anyone knows what is the right version of the FindPath() method? the one in the repo or the one in the lecture? I’ve tryed to seek in the comments below but it is still not clear which one is latest version.
this is the version in the repo:
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);
}
}
}
and thiis is the one in the lecture:
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);
}
}
}
The “parent” version is supposed to get the childs in the parent that is tagged with “Path” withoud the risk of getting the child in random order and possibly messing up the pathing,
Iis the first one that is in the repo doing the same thing but without using the parent trick?
Or is just the one in the lecture the one to follow?
Probably i’ve overthinking this as i always do, and this methods will be replaced anyway further in the project, but man… ADHD and OCD combined are a pain in the butt.