From 3a950cd33e264547379d463344d7940b40e3dccc Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 19 Oct 2020 14:05:48 +0200 Subject: [PATCH] [unity] Now SpineSettings.asset file can be placed anywhere in the Assets directory. Closes #1789. --- .../Editor/Windows/SpinePreferences.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs index c264e276b..e3cb1c036 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs @@ -111,6 +111,9 @@ namespace Spine.Unity.Editor { internal static SpinePreferences GetOrCreateSettings () { var settings = AssetDatabase.LoadAssetAtPath(SPINE_SETTINGS_ASSET_PATH); + + if (settings == null) + settings = FindSpinePreferences(); if (settings == null) { settings = ScriptableObject.CreateInstance(); @@ -126,6 +129,18 @@ namespace Spine.Unity.Editor { return settings; } + static SpinePreferences FindSpinePreferences () { + string typeSearchString = " t:SpinePreferences"; + string[] guids = AssetDatabase.FindAssets(typeSearchString); + foreach (string guid in guids) { + string path = AssetDatabase.GUIDToAssetPath(guid); + var preferences = AssetDatabase.LoadAssetAtPath(path); + if (preferences != null) + return preferences; + } + return null; + } + public static void HandlePreferencesGUI (SerializedObject settings) { float prevLabelWidth = EditorGUIUtility.labelWidth;