hybridCLR热更遇到问题

报错1:

No ‘git‘ executable was found. Please install Git on your system then restart

下载Git安装: Git - Downloading Package

配置:https://blog.csdn.net/baidu_38246836/article/details/106812067

重启电脑

unity:

hybridclr->generate->all

hybridclr->build->buildassetscopytostreamingassets

hybridclr-》build->win64

报错2:

Building Library\Bee\artifacts\WinPlayerBuildProgram\mpmc6\bt9a_o_vm6.lump.obj failed with output:

xg9o_vm6.lump.cpp

https://forum.unity.com/threads/workaround-for-building-with-il2cpp-with-visual-studio-2022-17-4.1355570/

 原因是vs2022的问题,用vs2019就好了 或者是在vs2022里写一个脚本直接扔到工程的Assets文件夹下就可以了,脚本如下,就可以打包出来了hybridclr-》build->win64

MsvcStdextWorkaround.cs

#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

hybridCLR热更遇到问题_第1张图片

你可能感兴趣的:(unity引擎,unity)