generated from max/template-unity-project
63 lines
2.2 KiB
C#
63 lines
2.2 KiB
C#
|
using System.Collections.Generic;
|
||
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace VertexColor.ScenePartition.Editor
|
||
|
{
|
||
|
public class ScenePartitionEditorWindow : EditorWindow
|
||
|
{
|
||
|
private Vector2 scrollPos = Vector2.zero;
|
||
|
|
||
|
[MenuItem("Max/ScenePartitionWindow")]
|
||
|
public static void ShowExample()
|
||
|
{
|
||
|
ScenePartitionEditorWindow window = GetWindow<ScenePartitionEditorWindow>();
|
||
|
window.titleContent = new GUIContent($"{nameof(ScenePartitionEditorWindow)}");
|
||
|
}
|
||
|
|
||
|
private void OnGUI()
|
||
|
{
|
||
|
DrawSceneDataCache();
|
||
|
}
|
||
|
|
||
|
private void DrawSceneDataCache()
|
||
|
{
|
||
|
using (EditorGUILayout.ScrollViewScope scope = new EditorGUILayout.ScrollViewScope(scrollPos))
|
||
|
{
|
||
|
scrollPos = scope.scrollPosition;
|
||
|
|
||
|
using (new EditorGUI.DisabledGroupScope(true))
|
||
|
{
|
||
|
ScenePartitionSS scenePartitionSS = ScenePartitionSS.instance;
|
||
|
|
||
|
foreach (KeyValuePair<ScenePartitionSO, ScenePartitionData> sceneData in scenePartitionSS.SceneDataCache)
|
||
|
{
|
||
|
EditorGUILayout.LabelField($"{sceneData.Key.name}");
|
||
|
|
||
|
if (sceneData.Value.HasCreatedPartitions)
|
||
|
{
|
||
|
EditorGUILayout.LabelField($"scenePartitions");
|
||
|
|
||
|
foreach (KeyValuePair<uint, ScenePartition> scenePartition in sceneData.Value.ScenePartitions)
|
||
|
{
|
||
|
EditorGUILayout.IntField((int)scenePartition.Value.id);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
EditorGUILayout.Space();
|
||
|
|
||
|
if (sceneData.Value.HasLoadedPartitions)
|
||
|
{
|
||
|
EditorGUILayout.LabelField($"loadedScenePartitions");
|
||
|
|
||
|
foreach (KeyValuePair<uint, ScenePartition> scenePartition in sceneData.Value.LoadedScenePartitions)
|
||
|
{
|
||
|
EditorGUILayout.IntField((int)scenePartition.Value.id);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|