OnInspectorGUI() Can I link two GameObjects both ways?

I have two game objects, say ObjA, and Objb.
ObjA has a list of ObjB objects, which I’ve made a custom list for, works great :slight_smile:

ObjB has a ObjA reference, and I’ve fiddled for a bit, and think its time to ask for help…

When I set an ObjB in the custom list of ObjA, I want the ObjA reference in ObjB to update, so that ObjA points to many children objects, but those children objects also have a reference to their parent…

Here is the snippet of code where I am stuck, I would paste the lot, but seriously, this is not something I just started yesterday…

        EditorGUILayout.LabelField("Regions in Archetype");
        SerializedProperty regions = serializedObject.FindProperty("Regions");
        for (int i = 0; i < regions.arraySize; i++)
        {
            EditorGUILayout.BeginHorizontal();
            if (EditorGUILayout.PropertyField(regions.GetArrayElementAtIndex(i), GUIContent.none))
                ((Regions)regions.GetArrayElementAtIndex(i).objectReferenceValue).SetArchetype(((GameObject)serializedObject.targetObject).GetComponent("Archetypes") as Archetypes);
            if (GUILayout.Button(new GUIContent("-", "Delete"), EditorStyles.miniButtonRight, GUILayout.Width(20)))
            {
                int oldSize = regions.arraySize;
                regions.DeleteArrayElementAtIndex(i);
                if (regions.arraySize == oldSize)
                    regions.DeleteArrayElementAtIndex(i);
            }
            EditorGUILayout.EndHorizontal();
        }

Lines #6 & #7 are not doing much it seems, it certainly isn’t going the way I want…

The code seems fine however there is no ObjA and ObjB inditated anywhere. Out of curiosity why don’t you use a System.Collections.Generic.List instead ? that should be much easier to manipulate ?