Never mind it works …
I just had a typo… fixed code unless someone wants it…
How to loop thru items under parent and assign their transforms by name.
Transform paintuse;
Transform paintfire;
Transform paintpick;
// Use this for initialization
void Awake ()
{
//get refrences to all child targets by their transform name.
foreach (Transform t in transform)
{
switch (t.name)
{
case "PaintTarget_Use":
paintuse = t.GetComponent<Transform>();
break;
case "PaintTarget_Pick":
paintpick = t.GetComponent<Transform>();
Debug.LogError("found");
break;
case "PaintTarget_Fire":
paintfire = t.GetComponent<Transform>();
break;
}
}
}