/// <summary> /// Display GUI for updating the preview shown in the editor /// </summary> public void PreviewUpdate() { EditorGUILayout.Space(); EditorGUILayout.Separator(); EditorGUILayout.Space(); if (GUILayout.Button("Generate")) { if (_config.Generator.GenerationRadius > 4) { int amt = TilePool.GetTilePositionsFromRadius( _config.Generator.GenerationRadius, new Vector2(0, 0), _config.Generator.Length) .Count; string msg = "You are about to generate " + amt + " Tiles synchronously which " + "may take a while. Are you sure you want to continue?"; if (EditorUtility.DisplayDialog("Warning", msg, "Continue")) { _config.GenerateEditor(); } } else { _config.GenerateEditor(); } } if (GUILayout.Button("Clear Tiles")) { if (_config.Generator != null && _config.Generator.Pool != null) { _config.Generator.Pool.RemoveAll(); } } }
/// <summary> /// Display GUI for updating the preview shown in the editor /// </summary> public void PreviewUpdate() { EditorGUILayout.Space(); EditorGUILayout.Separator(); EditorGUILayout.Space(); if (GUILayout.Button("Generate")) { if (_config.Generator.GenerationRadius > 4) { int amt = TilePool.GetTilePositionsFromRadius( _config.Generator.GenerationRadius, new Vector2(0, 0), _config.Generator.Length) .Count; string msg = "You are about to generate " + amt + " Tiles synchronously which " + "may take a while. Are you sure you want to continue?"; if (EditorUtility.DisplayDialog("Warning", msg, "Continue")) { _config.GenerateEditor(); } } else { _config.GenerateEditor(); } } if (GUILayout.Button("Clear Tiles")) { if (_config.Generator != null && _config.Generator.Pool != null) { _config.Generator.Pool.RemoveAll(); //Remove any trailing Tile components foreach (Tile t in _config.GetComponents <Tile>()) { #if UNITY_EDITOR Object.DestroyImmediate(t.gameObject); #else Object.Destroy(t.gameObject); #endif } } } }