Unity2022.1.24f1新建2D(URP)項目后一連串報錯的問題
最近安裝了Unity2022.1.24f1這個版本,結果新建2D(URP)項目后,直接給出一連串報錯,百度查了半天也沒查出有價值的信息。重裝Unity,也重裝VS,問題依然存在,最后一咬牙,重裝了最新版Win10系統(tǒng),版本22H2,再直接安裝Unity,并且不安裝VS,在這么干凈的環(huán)境下新建項目,結果還是報錯。
在QQ、微信和B站問了一圈,有高手給出的回答是兼容性問題,也就是這個版本的Unity和我的電腦硬件不兼容,讓我換個版本試試。
果然,之后分別安裝了Unity2021.3.28f1這個舊版本和2022.3.2f1c1這個新版本,新建項目一切都正常。至于2022.1.24f1這個版本,我拿到另一臺電腦上安裝、運行、新建項目,也一切正常??磥磉@就是傳說中軟件和硬件的兼容性問題。
把Unity報錯信息和我電腦的硬件配置附在下面,說不定會有和我一樣遇到相同問題的人,他們在網(wǎng)上搜索時如果能搜到這篇文章,也許能有點幫助。
一、部分報錯信息的文字版(方便搜索)
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崩潰的截圖

四、電腦的配置截圖

