Unity2022.1.24f1新建2D(URP)项目后一连串报错的问题
最近安装了Unity2022.1.24f1这个版本,结果新建2D(URP)项目后,直接给出一连串报错,百度查了半天也没查出有价值的信息。重装Unity,也重装VS,问题依然存在,最后一咬牙,重装了最新版Win10系统,版本22H2,再直接安装Unity,并且不安装VS,在这么干净的环境下新建项目,结果还是报错。
在QQ、微信和B站问了一圈,有高手给出的回答是兼容性问题,也就是这个版本的Unity和我的电脑硬件不兼容,让我换个版本试试。
果然,之后分别安装了Unity2021.3.28f1这个旧版本和2022.3.2f1c1这个新版本,新建项目一切都正常。至于2022.1.24f1这个版本,我拿到另一台电脑上安装、运行、新建项目,也一切正常。看来这就是传说中软件和硬件的兼容性问题。
把Unity报错信息和我电脑的硬件配置附在下面,说不定会有和我一样遇到相同问题的人,他们在网上搜索时如果能搜到这篇文章,也许能有点帮助。
一、部分报错信息的文字版(方便搜索)
FormatException: Input string was not in a correct format.
System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) (at <252f5a151e57406087568ebdeb88d5fe>:0)
System.Number.ParseInt32 (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) (at <252f5a151e57406087568ebdeb88d5fe>:0)
System.Int32.Parse (System.String s) (at <252f5a151e57406087568ebdeb88d5fe>:0)
Burst.Compiler.IL.Jit.JitCompilerService.GetAssemblyPaths (System.String folders) (at <cd6e15731ab84616a776e8bda4f822ab>:0)
Burst.Compiler.IL.Jit.JitCompilerService.EnsureLibraryCacheLoaded (System.String assemblyPaths) (at <cd6e15731ab84616a776e8bda4f822ab>:0)
Burst.Compiler.IL.Jit.JitCompilerService.CompileInternal (System.String fullMethodName, System.String assemblyPaths, System.IntPtr userdata, Unity.Burst.NativeDumpFlags dumpFlags, System.IntPtr compilerCallbackPointer, System.IntPtr logCallBack, System.String compilerFlags) (at <cd6e15731ab84616a776e8bda4f822ab>:0)
Unity.Burst.LowLevel.BurstCompilerService:GetDisassembly(MethodInfo, String)
Unity.Burst.BurstCompiler:SendRawCommandToCompiler(String)
Unity.Burst.CommandBuilder:SendToCompiler()
Unity.Burst.BurstCompiler:SendCommandToCompiler(String, String)
Unity.Burst.BurstCompiler:RequestSetProtocolVersion(Int32)
Unity.Burst.Editor.BurstLoader:.cctor()
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
Assertion failed on expression: 'exception == SCRIPTING_NULL'
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Burst.BurstCompiler:SendRawCommandToCompiler (string) (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/BurstCompiler.cs:737)
Unity.Burst.BurstCompiler/CommandBuilder:SendToCompiler () (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/BurstCompiler.cs:96)
Unity.Burst.BurstCompiler:SendCommandToCompiler (string,string) (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/BurstCompiler.cs:751)
Unity.Burst.BurstCompiler:RequestSetProtocolVersion (int) (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/BurstCompiler.cs:618)
Unity.Burst.Editor.BurstLoader:.cctor () (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/Editor/BurstLoader.cs:207)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
Assertion failed on expression: 'exception == SCRIPTING_NULL'
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Burst.BurstCompiler:Compile (object,System.Reflection.MethodInfo,bool,bool) (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/BurstCompiler.cs:469)
Unity.Burst.BurstCompiler:CompileILPPMethod2 (System.RuntimeMethodHandle) (at Library/PackageCache/com.unity.burst@1.7.4/Runtime/BurstCompiler.cs:230)
UnityEditor.U2D.Common.ImagePacker/UnityEditor.U2D.Common.BurstedBlit_00000005$BurstDirectCall:.cctor ()
$BurstDirectCallInitializer:Initialize ()
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'UnityEditor.U2D.Common.BurstedBlit_00000005$BurstDirectCall' threw an exception. ---> System.InvalidOperationException: Burst failed to compile the function pointer `Void BurstedBlit(UnityEngine.Color32*, Unity.Mathematics.int4 ByRef, Unity.Mathematics.int4 ByRef, Int32, Int32, UnityEngine.Color32*)`
at Unity.Burst.BurstCompiler.Compile (System.Object delegateObj, System.Reflection.MethodInfo methodInfo, System.Boolean isFunctionPointer, System.Boolean isILPostProcessing) [0x0015a] in D:\存档\Unity\新建文件夹 (2)\My project (2)\Library\PackageCache\com.unity.burst@1.7.4\Runtime\BurstCompiler.cs:469
at Unity.Burst.BurstCompiler.CompileILPPMethod2 (System.RuntimeMethodHandle burstMethodHandle) [0x0003a] in D:\存档\Unity\新建文件夹 (2)\My project (2)\Library\PackageCache\com.unity.burst@1.7.4\Runtime\BurstCompiler.cs:230
at UnityEditor.U2D.Common.ImagePacker+BurstedBlit_00000005$BurstDirectCall.Constructor () [0x00000] in <ad86505d49654f7d9e298dfff334736e>:0
at UnityEditor.U2D.Common.ImagePacker+BurstedBlit_00000005$BurstDirectCall..cctor () [0x00000] in <ad86505d49654f7d9e298dfff334736e>:0
--- End of inner exception stack trace ---
at $BurstDirectCallInitializer.Initialize () [0x00000] in <ad86505d49654f7d9e298dfff334736e>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <252f5a151e57406087568ebdeb88d5fe>:0
--- End of inner exception stack trace ---
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <252f5a151e57406087568ebdeb88d5fe>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <252f5a151e57406087568ebdeb88d5fe>:0
at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethodAttributes () [0x000a5] in <2adcb7d86536472884d6a11c9ab8e115>:0
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()
二、部分报错信息的截图

三、退出时Unity崩溃的截图

四、电脑的配置截图

