This commit is contained in:
edy
2026-05-11 10:32:47 +08:00
parent e509522188
commit c5d1aabad1
2 changed files with 86 additions and 58 deletions
+17 -17
View File
@@ -11,23 +11,23 @@ public class PostProcessBuild : IPostprocessBuildWithReport
public void OnPostprocessBuild(UnityEditor.Build.Reporting.BuildReport report)
{
// 检查是否为 iOS 平台构建
// if (report.summary.platform == BuildTarget.iOS)
// {
// string projectPath = report.summary.outputPath;
// string customControllerPath = "Assets/Editor/UnityAppController.mm"; // 自定义文件的路径
// string destinationPath = Path.Combine(projectPath, "Classes/UnityAppController.mm");
//检查是否为 iOS 平台构建
if (report.summary.platform == BuildTarget.iOS)
{
string projectPath = report.summary.outputPath;
string customControllerPath = "Assets/Editor/UnityAppController.mm"; // 自定义文件的路径
string destinationPath = Path.Combine(projectPath, "Classes/UnityAppController.mm");
// if (File.Exists(customControllerPath))
// {
// // 复制文件到 Xcode 项目中
// File.Copy(customControllerPath, destinationPath, overwrite: true);
// Debug.Log("Custom UnityAppController.mm has been copied to Xcode project.");
// }
// else
// {
// Debug.LogError("Custom UnityAppController.mm file not found at " + customControllerPath);
// }
// }
if (File.Exists(customControllerPath))
{
// 复制文件到 Xcode 项目中
File.Copy(customControllerPath, destinationPath, overwrite: true);
Debug.Log("Custom UnityAppController.mm has been copied to Xcode project.");
}
else
{
Debug.LogError("Custom UnityAppController.mm file not found at " + customControllerPath);
}
}
}
}