Unity使用IL2CPP方式打Windows包

这篇具有很好参考价值的文章主要介绍了Unity使用IL2CPP方式打Windows包。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

笔者Unity版本2021.3.8f1

1,确保安装了对应版本的扩展包:UnitySetup-Windows-IL2CPP-Support-for-Editor

2,打包报错:

error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details:
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Internal build system error. BuildProgram exited with code -2146233088.
error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details:
IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
 * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended)
 * Visual Studio 2019 with C++ compilers and Windows 10 SDK
 * Visual Studio 2017 with C++ compilers and Windows 10 SDK
 * Visual Studio 2015 with C++ compilers and Windows 10 SDK

Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables.
Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables.
Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry.

Unable to detect any compatible Visual Studio installation!
 * Found Visual Studio 2022 installation without C++ tool components

Windows 10 SDK is not installed. You can install from here: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/


Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
 * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended)
 * Visual Studio 2019 with C++ compilers and Windows 10 SDK
 * Visual Studio 2017 with C++ compilers and Windows 10 SDK
 * Visual Studio 2015 with C++ compilers and Windows 10 SDK

Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables.
Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables.
Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry.

这里:unable-to-build-il2cpp 建议使用Visual Studio Installer补充安装一些C++相关的工具包。
Unity使用IL2CPP方式打Windows包

3,若依旧报错类似Building Library\Bee\artifacts\WinPlayerBuildProgram\ei6vj\ejx6_b_vm6.lump.obj failed with output: i3ib_vm6.lump.cpp
可以考虑把如下脚本放到Assets目录下(来自这里)文章来源地址https://www.toymoban.com/news/detail-507725.html

#if UNITY_EDITOR
using System;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
public class MsvcStdextWorkaround : IPreprocessBuildWithReport
{
    const string kWorkaroundFlag = "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS";
    public int callbackOrder => 0;
    public void OnPreprocessBuild(BuildReport report)
    {
        var clEnv = Environment.GetEnvironmentVariable("_CL_");
        if (string.IsNullOrEmpty(clEnv))
        {
            Environment.SetEnvironmentVariable("_CL_", kWorkaroundFlag);
        }
        else if (!clEnv.Contains(kWorkaroundFlag))
        {
            clEnv += " " + kWorkaroundFlag;
            Environment.SetEnvironmentVariable("_CL_", clEnv);
        }
    }
}
#endif // UNITY_EDITOR

到了这里,关于Unity使用IL2CPP方式打Windows包的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • unity导入Android报错Unity.IL2CPP.Building.BuilderFailedException

    把从unity导出的Android包作为一个模块嵌入至Android程序 在解决了sdk31损坏等一系列问题,终于将程序成功安装到了手机上,以为就要通向光明未来了,结果在手机端调试时发现本人手机硬件(高通778,v8)不支持unity程序。 经过百度发现我导出的unity项目只支持处理器架构v7的手

    2024年02月05日
    浏览(27)
  • Unity 安卓构建错误:IL2cpp 需要提取的资源提取失败

    Unity 安卓构建错误:IL2cpp 需要提取的资源提取失败 问题描述: 在 Unity 中进行安卓构建时,可能会遇到一个报错信息:“failed to extract resources needed by IL2cpp”。这个错误通常发生在将 Unity 项目构建为安卓应用程序时,而 IL2cpp 则是 Unity 用于将 C# 代码编译为本地代码的工具。

    2024年02月04日
    浏览(30)
  • 2023年Unity Il2CPP/MONO FPS逆向工程

    实战引擎 : Unity Il2CPP/Mono 学完可做 : 森林之子,后室,逃离塔科夫,BattleBit,Rust等 几乎通杀全部Unity引擎游戏 简介: 实战编程代码:C/C++ B站空间:https://space.bilibili.com/2134677790 课程详细目录 :2023年Unity Il2CPP/MONO FPS逆向工程 · 语雀 联系方式 :点击课程详细目录查看 效果图

    2024年02月13日
    浏览(32)
  • 解决Unity安卓编译错误: IL2CPP需要的资源提取失败

    解决Unity安卓编译错误: IL2CPP需要的资源提取失败 在开发Unity游戏时,我们经常会遇到各种各样的问题。其中一个常见的问题是,当我们尝试将游戏导出为Android应用程序时,可能会遇到一个名为\\\"Failed to extract resources needed by IL2CPP\\\"的错误。本文将介绍如何解决这个问题,并提供

    2024年02月03日
    浏览(28)
  • 反编译Unity IL2CPP APK:深入探索逆向工程技术

    反编译Unity IL2CPP APK:深入探索逆向工程技术 在移动应用开发领域中,Unity引擎被广泛使用以创建令人惊叹的游戏和应用程序。然而,有时候我们可能需要研究某些应用程序的内部机制或者了解其实现细节。本文将介绍如何反编译基于Unity引擎的IL2CPP APK,并提供相应的源代码和

    2024年02月06日
    浏览(34)
  • Unity2020 打包报错:windowUnity.IL2CPP.Building.BuilderFailedException

    在打包的时候报错:windowUnity.IL2CPP.Building.BuilderFailedException 解决方法:把IL2CPP换成mono,重新打包即可 依次点击:Edit-Player-Configuration-Mono 再次重新打包即可

    2024年02月16日
    浏览(32)
  • 新版UNITY游戏(IL2CPP类型)使用内嵌型机器翻译插件XUnity.AutoTranslator的食用方法

    #新版UNITY游戏(IL2CPP类型)使用内嵌型机器翻译插件XUnity.AutoTranslator的食用方法# 文档更新时间:2022/4/3 20:02:50 网络具备访问github.com的能力 能够进行网页翻译的浏览器(用来查看官方的说明文档),以及耐心 网络能够访问机器翻译服务(谷歌等),如果使用百度需要注册百

    2024年02月09日
    浏览(78)
  • 初识IL2CPP

    在Unity中进行打包时,有两种打包方式选择: Mono 和 IL2CPP Mono和IL2Cpp是Unity的脚本后处理方式,通过脚本后处理实现Unity的跨平台 (1). Mono组成组件: C#编辑器,CLI虚拟机,以及核心类别程序库 (2).跨平台过程 Mono通过C#编辑器把脚本打包成中间语言(IL)IL所在的文件就是.dll后缀的

    2024年02月14日
    浏览(37)
  • Unity WebGL 打包il2cpp.exe did not run properly!

    是中文问题,WebGL的illcpp对执行过程中一点点的中文都不允许存在。包括 硬盘的中文名称 参考 如何更改磁盘盘符的名字 我的文档中的用户名有中文 系统用户名有中文 win+L封锁之后解锁会出现当前系统用户是否有中文 打包路径中有中文 这个很好解决 环境变量中有中文 由于

    2024年02月16日
    浏览(37)
  • Unity IL2CPP包Crash闪退提示 Cause: null pointer dereference 解决办法

    最近打包到安卓测试时进logo后一直闪退,打开Android Logcat后发现抛出crash 看样子是空引用崩溃的 在网上找了几个方法来试试,到最后才发现是场景里有Missing物体 方法1.关闭StripEngineCode 在Project Settings选择Player页,在里面的Other Settings取消勾选Strip Engine Code 我试了这个对我没用

    2024年03月17日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包