ScenePartition/Editor/ScenePartitionSOEditor.cs

48 lines
1.3 KiB
C#
Raw Normal View History

using UnityEngine;
using UnityEditor;
using System.IO;
namespace VertexColor.ScenePartition.Editor
{
[CustomEditor(typeof(ScenePartitionSO))]
public class ScenePartitionSOEditor : UnityEditor.Editor
{
//SerializedProperty property;
void OnEnable()
{
//property = serializedObject.FindProperty("myProperty");
}
public override void OnInspectorGUI()
{
DrawDefaultInspector();
ScenePartitionSO scenePartitionSO = (target as ScenePartitionSO);
serializedObject.Update();
//EditorGUILayout.PropertyField(property);
serializedObject.ApplyModifiedProperties();
if (GUILayout.Button("Load"))
{
ScenePartitionUtils.Load(scenePartitionSO);
}
if (GUILayout.Button("Save"))
{
ScenePartitionUtils.Save(scenePartitionSO);
}
if (GUILayout.Button("Unload"))
{
ScenePartitionUtils.Unload(scenePartitionSO);
}
if(GUILayout.Button("Open Scene Data"))
{
EditorUtility.RevealInFinder(ScenePartitionUtils.GetDataPath(scenePartitionSO));
}
}
}
}