ExecuteInEditMode obj ref not set to inst of obj?

Iterating through a layered loop:

//earlier

obj = Instantiate (aPrefab,new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
BBBBBBList.Add (obj);


//later

for (i = 0; i < AAAAAList.Count; i++) {
//stuff with A list
                		
for (n = 0; n < BBBBBBList.Count; n++) {
someObject = BBBBBBList[n]; //null 

}
}

a and b list are both filled with instances generated in editor mode. Worked fine as runtime. Is there some gotcha for instancing copy’s in editor mode?

EDIT: List B of gameObjects is null. But list count is correct.

Im begining to think this is the issue for some reason in an editor script only, returning the wrong type or something to the list, maybe editoronly bug? Strange because I use snippet below for other prefab objects in list A and those are not null.

obj = Instantiate (aPrefab,new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
BBBBBBList.Add (obj);

I always used GetComponent to add the Transform Reference to my List, instead of a snapshot.

Let me dig out one of my ancient use cases.

Yeah here we go, I generate a ‘Block’ filling out 5 out of 6 elements of my struct. The 6th being the transform. After I instantiated my object I simply

newBlock.thisTransform = clone.GetComponent(Transform); // to add the new transform instance to the Block, which then gets added to my List.

So yes, GetComponent for the Win.

The problem was, don’t use public list in editor scripts. My first list was static, and worked, the second was public and did not take the added objects correctly. And so, you dont need to use PrefabUtility as I had thought maybe either. Just simply use static lists.

Public built in arrays and other values are fine, I think, but Editor does not like public generic lists.