Setup parameters and play scene from editor script

I am making a game where player needs to avoid a preset waves of obstacles. I have that data stored in a scriptable object and I populate it using an editor script.

I also have some setup, which is basically a couple of parameters whether i want to test and which wave i want to test, on my spawner. What I want to do is a clean way of triggering that setup from editor script. I can start the play mode just fine but I couldn’t find a way to set those parameters on my spawner. Any help is appreciated.

Thanks

An editor class needs to be set as the editor for the correct class. The example code you provided lacks a [CustomEditor] tag, but it seems like it’s a custom editor for the MyScriptableObject class?

Anyways, to do what you’re asking for, this is a decent example:

[CustomEditor(typeof(SpawnManager))]
public class SpawnManagerEditor : Editor {
    
    public override void OnInspectorGUI() {
        DrawDefaultInspector();

        // the target variable is the selected object of the type defined in the CustomEditor tag
        SpawnManager manager = (SpawnManager) target; 

        if (GUILayout.Button("Play in debug mode")) {
            manager.IsDebug = true;
            EditorApplication.isPlaying = true;
        }

        if(GUILayout.Button("Play in normal mode")) {
            manager.IsDebug = false;
            EditorApplication.isPlaying = true;
        }
    }
}