Custom inspector array issues for loop
public override void OnInspectorGUI(){
for (int i = 0; i < S.numberOfObs; i++) {
spawnObjects[i] = (GameObject)EditorGUILayout.ObjectField (spawnObjects[i], typeof(GameObject), true);
S.randomLocation [i] = EditorGUILayout.Toggle ("Random Locaton", S.randomLocation [i]);
}
}
I cannot get these fields to allow me to change the boolean value to true and have it stay true it changes right back, it is hardly noticeable that it does change unless you use a debug. Also with the first one creating multiple gameobjects I cannot drag an object into there it does not work. Any ideas using for loops with arrays in a custom inspector? I just want to be able to create as many items as necessary without having to have a separate gameobject / boolean for each.
Comment