Hello!
Just watched the lecture where we learn about using the foreach loops for the first time.
foreach (Transform child in pathPrefab.transform)
{
waveWaypoints.Add(child);
}
My questions are:
- Does the name “child” affect what is being retrieved from pathPrefab?
- If not, by writing “in pathPrefab.transform” it knows only to get the children?
- If I wanted to get the transform of the pathPrefab GameObject itself in a “foreach” loop how would I do it, or would I never use a “foreach” loop for this situation?
- Off of that, if I wanted to get the transform component from both the pathPrefab AND its children, how would I write that?
Sorry if this is an overwhelming amount of questions…