public override void OnInspectorGUI() { DunGen script = (DunGen)target; if (DrawDefaultInspector()) { if (Application.isPlaying) { script.Generate(); } } if (GUILayout.Button("Generate")) { if (Application.isPlaying) { script.Generate(); } } }