using System.Collections.Generic; using UnityEditor; using UnityEngine; 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(); if (GUILayout.Button("Force Serialize")) { AssetDatabase.ForceReserializeAssets(new string[] { AssetDatabase.GetAssetPath(scenePartitionDataSO) }, ForceReserializeAssetsOptions.ReserializeAssetsAndMetadata); } using (new EditorGUI.DisabledGroupScope(true)) { if (scenePartitionDataSO.HasCreatedPartitions) { EditorGUILayout.LabelField($"scenePartitions"); foreach (KeyValuePair scenePartition in scenePartitionDataSO.ScenePartitions) { EditorGUILayout.IntField((int)scenePartition.Value.id); } } EditorGUILayout.Space(); if (scenePartitionDataSO.HasLoadedPartitions) { EditorGUILayout.LabelField($"loadedScenePartitions"); foreach (KeyValuePair scenePartition in scenePartitionDataSO.LoadedScenePartitions) { EditorGUILayout.IntField((int)scenePartition.Value.id); } } } } } }