[fix] 修复在Unity 2023及6000版本在iOS平台的构建bug

main
walon 2024-06-11 00:16:39 +08:00 committed by walon
parent 16a7d5d529
commit 9330cf682c
3 changed files with 37 additions and 1 deletions

View File

@ -7,7 +7,7 @@ using UnityEditor.Build;
using UnityEditor.Callbacks; using UnityEditor.Callbacks;
using UnityEngine; using UnityEngine;
#if UNITY_2022_2_OR_NEWER && (UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS) #if UNITY_2022 && (UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS)
namespace HybridCLR.Editor.BuildProcessors namespace HybridCLR.Editor.BuildProcessors
{ {

View File

@ -0,0 +1,34 @@
using HybridCLR.Editor.Installer;
using HybridCLR.Editor.Settings;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Callbacks;
using UnityEngine;
#if UNITY_2023_1_OR_NEWER && (UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS)
namespace HybridCLR.Editor.BuildProcessors
{
public static class AddLil2cppSourceCodeToXcodeproj2022OrNewer
{
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
{
if (!HybridCLRSettings.Instance.enable)
return;
CopyLibil2cppToXcodeProj(pathToBuiltProject);
}
private static void CopyLibil2cppToXcodeProj(string pathToBuiltProject)
{
string srcLibil2cppDir = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp";
string destLibil2cppDir = $"{pathToBuiltProject}/Il2CppOutputProject/IL2CPP/libil2cpp";
BashUtil.RemoveDir(destLibil2cppDir);
BashUtil.CopyDir(srcLibil2cppDir, destLibil2cppDir, true);
}
}
}
#endif

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2fa46135129b046a28014d58fdfd18ca