mirror of
https://github.com/ConjureETS/Unity_Utils.git
synced 2026-03-24 04:50:58 +00:00
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Diagnostics;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace SaveSystem
|
|
{
|
|
[CustomEditor(typeof(SaveManager), true)]
|
|
public class SaveManagerInspector : Editor
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
DrawDefaultInspector();
|
|
|
|
SaveManager saveManager = (SaveManager) target;
|
|
GUI.enabled = EditorApplication.isPlaying;
|
|
EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects);
|
|
EditorGUILayout.BeginHorizontal();
|
|
if (GUILayout.Button("Save", EditorStyles.miniButtonLeft))
|
|
{
|
|
saveManager.Save();
|
|
}
|
|
|
|
if (GUILayout.Button("Load", EditorStyles.miniButtonRight))
|
|
{
|
|
saveManager.Load();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
|
|
if (GUILayout.Button("Save to Json"))
|
|
{
|
|
saveManager.SaveExplicit();
|
|
}
|
|
|
|
GUI.enabled = true;
|
|
if (GUILayout.Button("Open explicit save in notepad++"))
|
|
{
|
|
Process.Start("notepad++.exe", Path.Combine(Application.dataPath, "../") + "saveData01.json");
|
|
}
|
|
EditorGUI.EndDisabledGroup();
|
|
}
|
|
}
|
|
} |