Map Editor in Unity Editor

I want to create a basic map editor in Unity. Primarily the goal is that a scene will have a “Map” object that stores information on the created map. My problem is I don’t know how to store an array in this object outside of runtime. I have a public function for building the array, but how do I initialize the array in the editor and then have it hold its value in the scene?

Something like this:

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.Collections;
using System.Collections.Generic;

[CustomEditor(typeof(MapGenerationScript))]
public class MapGenerationScriptExtension : Editor {
	
	#if UNITY_EDITOR
	override public void  OnInspectorGUI () {
		MapGenerationScript mapGenerationScript = (MapGenerationScript)target;
		if(GUILayout.Button("Fill Array")) {

			//fill your array or call a function anywhere that does it
			EditorUtility.SetDirty(mapGenerationScript);
		}

		if (GUI.changed) {
			EditorUtility.SetDirty(mapGenerationScript);
		}

		DrawDefaultInspector();
	}
	#endif
}

Be aware that this is wonky at best; I have been able to fill my array of a custom class but not all sub-classes are successfully kept after running the game.