修复Player.Build时,如果已经导出了工程,则不会混淆的bug

backup
walon 2025-04-19 12:55:59 +08:00
parent d83df4a2a5
commit 7ca5ec54b1
1 changed files with 5 additions and 4 deletions

View File

@ -31,9 +31,10 @@ namespace Obfuz
public void OnPreprocessBuild(BuildReport report) public void OnPreprocessBuild(BuildReport report)
{ {
s_obfuscated = false; s_obfuscated = false;
FileUtil.RemoveDir(GetScriptAssembliesPath());
} }
private static string GetScriptAssembliesPath(object obj) private static string GetScriptAssembliesPath()
{ {
#if UNITY_2021_1_OR_NEWER #if UNITY_2021_1_OR_NEWER
//object settings = obj.GetType().GetProperty("settings").GetValue(obj); //object settings = obj.GetType().GetProperty("settings").GetValue(obj);
@ -53,7 +54,7 @@ namespace Obfuz
} }
if (!s_obfuscated) if (!s_obfuscated)
{ {
RunObfuscate(GetScriptAssembliesPath(obj)); RunObfuscate(GetScriptAssembliesPath());
s_obfuscated = true; s_obfuscated = true;
} }
} }
@ -92,7 +93,7 @@ namespace Obfuz
Path.Combine(applicationContentsPath, "MonoBleedingEdge/lib/mono/4.7.1-api/Facades"), Path.Combine(applicationContentsPath, "MonoBleedingEdge/lib/mono/4.7.1-api/Facades"),
Path.Combine(applicationContentsPath, "MonoBleedingEdge/lib/mono/4.7.1-api"), Path.Combine(applicationContentsPath, "MonoBleedingEdge/lib/mono/4.7.1-api"),
#else #else
#error "Unsupported Unity version" #error "Unsupported Unity version"
#endif #endif
Path.Combine(applicationContentsPath, "Managed/UnityEngine"), Path.Combine(applicationContentsPath, "Managed/UnityEngine"),
backupPlayerScriptAssembliesPath, backupPlayerScriptAssembliesPath,
@ -116,4 +117,4 @@ namespace Obfuz
} }
} }
#endif #endif
} }