generated from max/template-unity-project
Updated ScenePartitionEditorWindow
- Added clear button here instead of in ScenePartitionSOEditor - Added editor util for horizontal line - Exposed scene grid cell size value
This commit is contained in:
parent
80c90d884a
commit
cf3198b0b7
20
Editor/EditorGUIUtils.cs
Normal file
20
Editor/EditorGUIUtils.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VertexColor.ScenePartition.Editor
|
||||
{
|
||||
public static class EditorGUIUtils
|
||||
{
|
||||
public static readonly Color horizontalLineColor = Color.white;
|
||||
|
||||
public static void HorizontalLine(Color color)
|
||||
{
|
||||
Color prev = GUI.color;
|
||||
GUI.color = color;
|
||||
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
|
||||
GUI.color = prev;
|
||||
}
|
||||
|
||||
public static void HorizontalLine() => HorizontalLine(horizontalLineColor);
|
||||
}
|
||||
}
|
11
Editor/EditorGUIUtils.cs.meta
Normal file
11
Editor/EditorGUIUtils.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: befa2e31a4a6ae04696dcd5b72554ea4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -19,11 +19,23 @@ public static void ShowExample()
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (GUILayout.Button("Save"))
|
||||
EditorGUILayout.LabelField("Cache", EditorStyles.boldLabel);
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
ScenePartitionSS.Save();
|
||||
if (GUILayout.Button("Save", EditorStyles.miniButtonLeft))
|
||||
{
|
||||
ScenePartitionSS.Save();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Clear", EditorStyles.miniButtonRight))
|
||||
{
|
||||
ScenePartitionSS.Save();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUIUtils.HorizontalLine();
|
||||
|
||||
DrawSceneDataCache();
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,8 @@ public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.LabelField($"generatedSceneGrid");
|
||||
|
||||
scenePartitionSO.Data.SceneGrid.cellSize = EditorGUILayout.IntSlider("cellSize", scenePartitionSO.Data.SceneGrid.cellSize, 10, 1000);
|
||||
|
||||
foreach (KeyValuePair<int, GridList> item in scenePartitionSO.Data.SceneGrid.Grid)
|
||||
{
|
||||
EditorGUILayout.LongField("gridId", item.Key);
|
||||
@ -97,12 +99,6 @@ public override void OnInspectorGUI()
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("ClearCache"))
|
||||
{
|
||||
scenePartitionSO.ClearCache();
|
||||
ScenePartitionSS.instance.SceneDataCache.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace VertexColor.ScenePartition
|
||||
public class SceneGrid
|
||||
{
|
||||
[SerializeField]
|
||||
private int cellSize = 10;
|
||||
public int cellSize = 10;
|
||||
|
||||
[SerializeField]
|
||||
private SceneGridDictionary grid = new SceneGridDictionary();
|
||||
|
Loading…
Reference in New Issue
Block a user