Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user