void OnGUI() { if (generator == null) { Close(); return; } if (sequenceEditor == null) { Init(generator, levelIndex); return; } EditorGUI.BeginChangeCheck(); if (levelIndex >= generator.levels.Length) { Close(); return; } if (generator.levels[levelIndex].remoteSequence) { minSize = new Vector2(210, 300); maxSize = new Vector2(210, 9000); } else { minSize = new Vector2(600, 600); maxSize = new Vector2(9000, 9000); sequenceEditor.viewRect = new Rect(5, 5, position.width - 208, position.height - 20); sequenceEditor.windowPosition = new Vector2(position.x, position.y); sequenceEditor.sequences = generator.levels[levelIndex].sequenceCollection.sequences; sequenceEditor.DrawEditor(); generator.levels[levelIndex].sequenceCollection.sequences = sequenceEditor.sequences; } WindowPanel.Reset(); WindowPanel.DrawPanel(settingsPanel); if (EditorGUI.EndChangeCheck()) { if (!Application.isPlaying) { UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene()); } } }