Hopefully a simple question, I have a prefab with a script. Inside the script I have a variable:
public MovementTypes[,] Movement;
MovementTypes is an enum.
In an Editor script, I have
for (int y = 0; y < 5; y++)
{
EditorGUILayout.BeginHorizontal ();
for (int x = 0; x < 5; x++)
myPieceType.Movement[x,y] = (PieceType.MovementTypes)EditorGUILayout.EnumPopup(myPieceType.Movement[x,y]);
EditorGUILayout.EndHorizontal ();
}
It works when Movement is not an array. As an array, it throws lots of NullReferenceExceptions. How do I make this work?