So here I'm getting a list of Objects, then getting the objects inside of each of their Lists.
targs = GetComponent().targets; //Array from Proxemics.cs
for (int i = 0; i < targs.Length; i++)
{
objs = targs[i].GetComponent().Objs;//List of Objects from ContentModule.cs
for (int j = 0; j < objs.Count; j++)
{
spaceObjectPrefabs.Add(objs[j]);
}
}
ContentModule.cs is attached to each of the targets from Proxemics.cs' array
So now I have all of the objects inside of each list. Now, I'm instantiating them for each Object that exists in the spaceObjectPrefabs List.
GameObject Object = Instantiate(item, new Vector3(0, 0, 0), rotation) as GameObject;
Object.transform.parent = gameObject.transform;
My question is how do I make each of these Object's parents the object that they originally belong to via their list. Sorry I'm trying my best to explain this and even I'm confused, only in psudocode can I explain.
foreach obj in spaceObjectPrefabList
transform.parent = object_that_holds_obj's_original_list.transform
↧