2023-06-25 15:51:54 +02:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEditor;
|
2023-06-26 01:03:14 +02:00
|
|
|
using UnityEngine;
|
2023-06-25 15:51:54 +02:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2023-06-26 01:03:14 +02:00
|
|
|
if (GUILayout.Button("Force Serialize"))
|
|
|
|
{
|
|
|
|
AssetDatabase.ForceReserializeAssets(new string[] { AssetDatabase.GetAssetPath(scenePartitionDataSO) }, ForceReserializeAssetsOptions.ReserializeAssetsAndMetadata);
|
|
|
|
}
|
|
|
|
|
2023-06-25 15:51:54 +02:00
|
|
|
using (new EditorGUI.DisabledGroupScope(true))
|
|
|
|
{
|
2023-06-26 01:03:14 +02:00
|
|
|
if (scenePartitionDataSO.HasCreatedPartitions)
|
2023-06-25 15:51:54 +02:00
|
|
|
{
|
|
|
|
EditorGUILayout.LabelField($"scenePartitions");
|
|
|
|
|
2023-06-26 01:03:14 +02:00
|
|
|
foreach (KeyValuePair<uint, ScenePartition> scenePartition in scenePartitionDataSO.ScenePartitions)
|
2023-06-25 15:51:54 +02:00
|
|
|
{
|
|
|
|
EditorGUILayout.IntField((int)scenePartition.Value.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
|
2023-06-26 01:03:14 +02:00
|
|
|
if (scenePartitionDataSO.HasLoadedPartitions)
|
2023-06-25 15:51:54 +02:00
|
|
|
{
|
|
|
|
EditorGUILayout.LabelField($"loadedScenePartitions");
|
|
|
|
|
2023-06-26 01:03:14 +02:00
|
|
|
foreach (KeyValuePair<uint, ScenePartition> scenePartition in scenePartitionDataSO.LoadedScenePartitions)
|
2023-06-25 15:51:54 +02:00
|
|
|
{
|
|
|
|
EditorGUILayout.IntField((int)scenePartition.Value.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-06-26 01:03:14 +02:00
|
|
|
}
|