diff --git a/Editor/3rds/UnityHook/HybridCLRHooks/CopyStrippedAOTAssembliesHook.cs b/Editor/3rds/UnityHook/HybridCLRHooks/CopyStrippedAOTAssembliesHook.cs index f7cd051..7e3373d 100644 --- a/Editor/3rds/UnityHook/HybridCLRHooks/CopyStrippedAOTAssembliesHook.cs +++ b/Editor/3rds/UnityHook/HybridCLRHooks/CopyStrippedAOTAssembliesHook.cs @@ -12,7 +12,7 @@ using System.IO; namespace HybridCLR.MonoHook { -#if UNITY_2021 && UNITY_IOS +#if UNITY_2021_1_OR_NEWER [InitializeOnLoad] public class CopyStrippedAOTAssembliesHook { diff --git a/Editor/BuildProcessors/CopyStrippedAOTAssemblies.cs b/Editor/BuildProcessors/CopyStrippedAOTAssemblies.cs index c98a338..3eb2746 100644 --- a/Editor/BuildProcessors/CopyStrippedAOTAssemblies.cs +++ b/Editor/BuildProcessors/CopyStrippedAOTAssemblies.cs @@ -25,19 +25,25 @@ namespace HybridCLR.Editor.BuildProcessors public static string GetStripAssembliesDir2021(BuildTarget target) { string projectDir = SettingsUtil.ProjectDir; -#if UNITY_STANDALONE_WIN - return $"{projectDir}/Library/Bee/artifacts/WinPlayerBuildProgram/ManagedStripped"; -#elif UNITY_ANDROID - return $"{projectDir}/Library/Bee/artifacts/Android/ManagedStripped"; -#elif UNITY_IOS - return $"{projectDir}/Library/Bee/artifacts/iOS/ManagedStripped"; -#elif UNITY_WEBGL - return $"{projectDir}/Library/Bee/artifacts/WebGL/ManagedStripped"; -#elif UNITY_EDITOR_OSX - return $"{projectDir}/Library/Bee/artifacts/MacStandalonePlayerBuildProgram/ManagedStripped"; -#else - throw new NotSupportedException("GetOriginBuildStripAssembliesDir"); -#endif + switch (target) + { + case BuildTarget.StandaloneWindows: + case BuildTarget.StandaloneWindows64: + return $"{projectDir}/Library/Bee/artifacts/WinPlayerBuildProgram/ManagedStripped"; + case BuildTarget.Android: + return $"{projectDir}/Library/Bee/artifacts/Android/ManagedStripped"; + case BuildTarget.iOS: + return $"{projectDir}/Library/Bee/artifacts/iOS/ManagedStripped"; + case BuildTarget.WebGL: + return $"{projectDir}/Library/Bee/artifacts/WebGL/ManagedStripped"; + case BuildTarget.StandaloneOSX: + return $"{projectDir}/Library/Bee/artifacts/MacStandalonePlayerBuildProgram/ManagedStripped"; + case BuildTarget.PS4: + return $"{projectDir}/Library/Bee/artifacts/PS4PlayerBuildProgram/ManagedStripped"; + case BuildTarget.PS5: + return $"{projectDir}/Library/Bee/artifacts/PS5PlayerBuildProgram/ManagedStripped"; + default: return ""; + } } #else private string GetStripAssembliesDir2020(BuildTarget target) @@ -78,9 +84,13 @@ namespace HybridCLR.Editor.BuildProcessors public void OnPostprocessBuild(BuildReport report) { -#if (UNITY_2021 && !UNITY_IOS) || UNITY_2022_1_OR_NEWER +#if UNITY_2021_1_OR_NEWER BuildTarget target = EditorUserBuildSettings.activeBuildTarget; - CopyStripDlls(GetStripAssembliesDir2021(target), target); + string srcStripDllPath = GetStripAssembliesDir2021(target); + if (!string.IsNullOrEmpty(srcStripDllPath) && Directory.Exists(srcStripDllPath)) + { + CopyStripDlls(srcStripDllPath, target); + } #endif } }