소스 검색

[unity] Now SpineSettings.asset file can be placed anywhere in the Assets directory. Closes #1789.

Harald Csaszar 4 년 전
부모
커밋
3a950cd33e
1개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs

+ 15 - 0
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<SpinePreferences>(SPINE_SETTINGS_ASSET_PATH);
+
+			if (settings == null)
+				settings = FindSpinePreferences();
 			if (settings == null)
 			{
 				settings = ScriptableObject.CreateInstance<SpinePreferences>();
@@ -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<SpinePreferences>(path);
+				if (preferences != null)
+					return preferences;
+			}
+			return null;
+		}
+
 		public static void HandlePreferencesGUI (SerializedObject settings) {
 
 			float prevLabelWidth = EditorGUIUtility.labelWidth;