mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[Unity] Use AssetDatabase for locating editor base directory (#1207)
The current method assumes the Spine Runtime exists in a sub-directory of the project's "Assets" folder. With the package manager, and the support of local packages in Unity 2018, the runtime could be located elsewhere. The AssetDatabase would be a more reliable option for finding this path.
This commit is contained in:
parent
3b92f7cb79
commit
c36e0a93ed
@ -188,9 +188,9 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
Preferences.Load();
|
||||
|
||||
var rootDir = new DirectoryInfo(Application.dataPath);
|
||||
FileInfo[] files = rootDir.GetFiles("SpineEditorUtilities.cs", SearchOption.AllDirectories);
|
||||
editorPath = Path.GetDirectoryName(files[0].FullName.Replace("\\", "/").Replace(Application.dataPath, "Assets"));
|
||||
var assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities");
|
||||
var assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
|
||||
editorPath = Path.GetDirectoryName(assetPath).Replace("\\", "/");
|
||||
editorGUIPath = editorPath + "/GUI";
|
||||
|
||||
Icons.Initialize();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user