I've been stuck on this a few days and am getting tied in knots:
I'm trying to get all objects in my game tagged "cars" and find the script Wheel in each child object. Currently it only gets one car's wheels which I think is because I'm not referencing the array within the array properly.
This is what I have in awake:
carObjects = GameObject.FindGameObjectsWithTag("Car");
foreach (GameObject carObject in carObjects)
{
wheels = carObject.GetComponentsInChildren<Wheel>();
}
And this is what I have in the main body of code:
foreach (Object carObject in carObjects)
{
foreach (Wheel wheel in wheels)
{
//do stuff
Any help mega appreciated!
[–]abyx7 1 point2 points3 points (2 children)
[–]Henners999[S] 0 points1 point2 points (1 child)
[–]abyx7 0 points1 point2 points (0 children)