38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
public class PrefabSettingsWindow : EditorWindow
|
|
{
|
|
public PrefabCreatorSettings CurrentSettings;
|
|
|
|
[MenuItem("Youssef Tools/Prefab Creator Setup")]
|
|
public static void ShowWindow() => GetWindow<PrefabSettingsWindow>("Setup Window");
|
|
|
|
private void OnEnable()
|
|
{
|
|
string SavedPath = EditorPrefs.GetString("YoussefTool_SettingsPath", "");
|
|
if (!string.IsNullOrEmpty(SavedPath))
|
|
{
|
|
CurrentSettings = AssetDatabase.LoadAssetAtPath<PrefabCreatorSettings>(SavedPath);
|
|
}
|
|
}
|
|
|
|
void OnGUI()
|
|
{
|
|
GUILayout.Label("Active Tool Settings", EditorStyles.boldLabel);
|
|
|
|
EditorGUI.BeginChangeCheck();
|
|
CurrentSettings = (PrefabCreatorSettings)EditorGUILayout.ObjectField(
|
|
"Prefab Creator Settings", CurrentSettings, typeof(PrefabCreatorSettings), false);
|
|
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
string path = AssetDatabase.GetAssetPath(CurrentSettings);
|
|
EditorPrefs.SetString("YoussefTool_SettingsPath", path);
|
|
}
|
|
|
|
if (CurrentSettings != null)
|
|
Editor.CreateEditor(CurrentSettings).OnInspectorGUI();
|
|
}
|
|
}
|