ScenePartition/Editor/ScenePartitionDataSOEditor.cs

66 lines
2.5 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using UnityEditor;
namespace VertexColor.ScenePartition.Editor
{
[CustomEditor(typeof(ScenePartitionDataSO))]
public class ScenePartitionDataSOEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
ScenePartitionDataSO scenePartitionDataSO = (target as ScenePartitionDataSO);
DrawDefaultInspector();
serializedObject.Update();
//EditorGUILayout.PropertyField(sceneAssetProperty);
serializedObject.ApplyModifiedProperties();
EditorGUILayout.Space();
using (new EditorGUI.DisabledGroupScope(true))
{
if (scenePartitionDataSO.hasCreatedPartitions)
{
EditorGUILayout.LabelField($"scenePartitions");
foreach (KeyValuePair<uint, ScenePartition> scenePartition in scenePartitionDataSO.scenePartitions)
{
EditorGUILayout.IntField((int)scenePartition.Value.id);
if (scenePartition.Value.references != null && scenePartition.Value.references.Count > 0)
{
EditorGUI.indentLevel++;
foreach (var reference in scenePartition.Value.references)
{
EditorGUILayout.IntField((int)reference);
}
EditorGUI.indentLevel--;
}
}
}
EditorGUILayout.Space();
if (scenePartitionDataSO.hasLoadedPartitions)
{
EditorGUILayout.LabelField($"loadedScenePartitions");
foreach (KeyValuePair<uint, ScenePartition> scenePartition in scenePartitionDataSO.loadedScenePartitions)
{
EditorGUILayout.IntField((int)scenePartition.Value.id);
if (scenePartition.Value.references != null && scenePartition.Value.references.Count > 0)
{
EditorGUI.indentLevel++;
foreach (var reference in scenePartition.Value.references)
{
EditorGUILayout.IntField((int)reference);
}
EditorGUI.indentLevel--;
}
}
}
}
}
}
}