mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[unity] Now SpineSettings.asset file can be placed anywhere in the Assets directory. Closes #1789.
This commit is contained in:
parent
90486705f6
commit
3a950cd33e
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user