Firstborn/Assets/ModTool/ModTool.Editor/SettingsEditorWindow.cs
Schaken-Mods 7502018d20 Adding Mod Support
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
2023-05-13 22:01:48 -05:00

59 lines
1.6 KiB
C#

using UnityEditor;
using UnityEngine;
using ModTool.Shared;
namespace ModTool.Editor
{
/// <summary>
/// ModTool's settings window.
/// </summary>
public class SettingsEditorWindow : EditorWindow
{
private ModToolSettings modToolSettings;
private CodeSettings codeSettings;
private UnityEditor.Editor modToolSettingsEditor;
private UnityEditor.Editor codeSettingsEditor;
Vector2 scrollPos = Vector2.zero;
/// <summary>
/// Open ModTool's settings window.
/// </summary>
[MenuItem("Tools/ModTool/Settings", priority = 0)]
public static void ShowWindow()
{
SettingsEditorWindow window = GetWindow<SettingsEditorWindow>();
window.maxSize = new Vector2(385f, 255);
window.minSize = new Vector2(300f, 162);
window.titleContent = new GUIContent("ModTool Settings");
}
void OnEnable()
{
modToolSettings = ModToolSettings.instance;
codeSettings = CodeSettings.instance;
modToolSettingsEditor = UnityEditor.Editor.CreateEditor(modToolSettings);
codeSettingsEditor = UnityEditor.Editor.CreateEditor(codeSettings);
}
void OnDisable()
{
DestroyImmediate(modToolSettingsEditor);
DestroyImmediate(codeSettingsEditor);
}
void OnGUI()
{
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
modToolSettingsEditor.OnInspectorGUI();
codeSettingsEditor.OnInspectorGUI();
EditorGUILayout.EndScrollView();
}
}
}