mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] Fixed compile errors with TK2D define due to asmdef files preventing dependency. Closes #1280.
This commit is contained in:
parent
0908d552a1
commit
e7030d640b
@ -1785,6 +1785,9 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
internal static void EnableTK2D () {
|
internal static void EnableTK2D () {
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
|
DisableSpineAsmdefFiles();
|
||||||
|
|
||||||
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
||||||
if (IsInvalidGroup(group))
|
if (IsInvalidGroup(group))
|
||||||
continue;
|
continue;
|
||||||
@ -1811,6 +1814,9 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
internal static void DisableTK2D () {
|
internal static void DisableTK2D () {
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
|
|
||||||
|
EnableSpineAsmdefFiles();
|
||||||
|
|
||||||
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
||||||
if (IsInvalidGroup(group))
|
if (IsInvalidGroup(group))
|
||||||
continue;
|
continue;
|
||||||
@ -1833,6 +1839,31 @@ namespace Spine.Unity.Editor {
|
|||||||
Debug.LogWarning("Already Removed Scripting Define Symbol " + SPINE_TK2D_DEFINE);
|
Debug.LogWarning("Already Removed Scripting Define Symbol " + SPINE_TK2D_DEFINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void DisableSpineAsmdefFiles() {
|
||||||
|
SetAsmdefFileActive("spine-unity-editor", false);
|
||||||
|
SetAsmdefFileActive("spine-unity", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void EnableSpineAsmdefFiles() {
|
||||||
|
SetAsmdefFileActive("spine-unity-editor", true);
|
||||||
|
SetAsmdefFileActive("spine-unity", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void SetAsmdefFileActive(string filename, bool setActive) {
|
||||||
|
|
||||||
|
string typeSearchString = setActive ? " t:textasset" : " t:asmdef";
|
||||||
|
string[] guids = AssetDatabase.FindAssets(filename + typeSearchString);
|
||||||
|
foreach (string guid in guids) {
|
||||||
|
string currentPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||||
|
string targetPath = System.IO.Path.ChangeExtension(currentPath, setActive ? "asmdef" : "txt");
|
||||||
|
if (System.IO.File.Exists(currentPath)) {
|
||||||
|
System.IO.File.Copy(currentPath, targetPath);
|
||||||
|
System.IO.File.Copy(currentPath + ".meta", targetPath + ".meta");
|
||||||
|
}
|
||||||
|
AssetDatabase.DeleteAsset(currentPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user