ScenePartition/Editor/ScenePartitionSOEditor.cs

60 lines
1.7 KiB
C#
Raw Normal View History

using UnityEngine;
using UnityEditor;
namespace VertexColor.ScenePartition.Editor
{
[CustomEditor(typeof(ScenePartitionSO))]
public class ScenePartitionSOEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
ScenePartitionSO scenePartitionSO = (target as ScenePartitionSO);
serializedObject.Update();
2023-06-24 16:43:10 +02:00
//EditorGUILayout.PropertyField(sceneAssetProperty);
serializedObject.ApplyModifiedProperties();
2023-06-24 16:43:10 +02:00
EditorGUILayout.Space();
2023-06-24 16:43:10 +02:00
if(scenePartitionSO.sceneAsset == null)
{
2023-06-24 16:43:10 +02:00
if (GUILayout.Button("Create Scene"))
{
scenePartitionSO.CreateScene();
}
}
2023-06-24 16:43:10 +02:00
else
{
2023-06-24 16:43:10 +02:00
if (GUILayout.Button("Load All"))
{
scenePartitionSO.LoadAll();
}
if (scenePartitionSO.hasLoadedPartitions)
{
if (GUILayout.Button("Save All"))
{
scenePartitionSO.SaveAll();
}
}
if (GUILayout.Button("Unload"))
{
scenePartitionSO.Unload();
}
if (GUILayout.Button("Open Scene Data Folder"))
{
EditorUtility.RevealInFinder(ScenePartitionUtils.GetDataPath(scenePartitionSO));
}
}
2023-06-24 16:43:10 +02:00
EditorGUILayout.Space();
using (new EditorGUI.DisabledGroupScope(true))
{
2023-06-24 16:43:10 +02:00
DrawDefaultInspector();
}
}
}
}