Can one specify the parent of a gameobject in an array?

Hello all. I am trying to update the parent-child relationships of some gameobjects that are contained in a GameObject fixed-length array (size 3). Basically, I have three simple gameobjects (no physics data, just mesh rendering, etc) loaded from Prefabs in my scene, each of which has a child GameObject that I want to assign as a child to one of three other, empty gameobjects, which act as position markers in my scene. My current approach to this is seen in “initializeVonSouffleQueue()” below.

Basically, however, I am having troubles with NullReferenceException errors, mostly coming from line 6 from the top of “updateVonSouffleQueue()” as below. I’m not quite sure how to fix things, however. At its simplest, I’m trying to do what is seen in this link, only with gameobjects contained inside arrays rather than single variables: Parenting and Re-Parenting

Any insight into how to better approach the matters of dynamic reassignment of array members and gameobject parent-child relationships in script would be helpful. Thanks.

void initializeVonSouffleQueue() {
        for (int i = 0; i < souffleQueue.Length; i++)
        {
            souffleQueue _= Instantiate((scriptCamera.ingredientTypeItem[0][Random.Range(0, numNeutralIngredient)] as GameObject).transform.FindChild("prefabIngredientFace"), queueGUI*.transform.position, Quaternion.identity) as GameObject;*_

souffleQueue_.transform.parent = queueGUI*.transform;
}*_

}

public void updateVonSouffleQueue() {
for (int i = 0; i < souffleQueue.Length-1; i++)
{
souffleQueue = souffleQueue[i+1];
souffleQueue_.transform.parent = queueGUI*.transform;
}
souffleQueue[2] = Instantiate((scriptCamera.ingredientTypeItem[0][Random.Range(0, numNeutralIngredient)] as GameObject).transform.FindChild(“prefabIngredientFace”), queueGUI[2].transform.position, Quaternion.identity) as GameObject;
}_

[1]: http://wiki.etc.cmu.edu/unity3d/index.php/Parenting_&_Re-Parenting*

Hello all. I’m replying to confirm that I’ve since resolved my problem.

There were a few things wrong in general, and I wound up refactoring my code several times before I was done. The key points though where that 1) I wasn’t keeping close enough track of what types my function calls were returning, 2) I didn’t fully understand how to interact with components and GameObjects effectively in script, and 3) I was attempting to alter the parent of a prefab object directly, rather than instantiating a clone and altering that instead.

To anyone who encounters similar issues, I suggest you take a close look at exactly what types you are working with in your scripts, particularly when it comes to working with built-in arrays (not javascript Arrays). I was particularly thrown by conversions between Transforms, Objects, and GameObjects; double-check this in the Unity official documentation. Also, ensure your arrays are actually being loaded with values properly; I kept getting Null Exceptions simply because my arrays kept winding up empty for one reason or another.

Hope this helps. Thanks to all who replied.