generated from max/template-unity-project
max
b6f9052cff
- Worked on serialization issues (some string data doesn't get correctly formatted, but was also not needed, so removed the data part from ScenePartition) - Moved some files to runtime (wip)
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
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<uint, ScenePartition> scenePartition in scenePartitionDataSO.ScenePartitions)
|
|
{
|
|
EditorGUILayout.IntField((int)scenePartition.Value.id);
|
|
}
|
|
}
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
if (scenePartitionDataSO.HasLoadedPartitions)
|
|
{
|
|
EditorGUILayout.LabelField($"loadedScenePartitions");
|
|
|
|
foreach (KeyValuePair<uint, ScenePartition> scenePartition in scenePartitionDataSO.LoadedScenePartitions)
|
|
{
|
|
EditorGUILayout.IntField((int)scenePartition.Value.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |