We are currently developing a 3D game in Unity 2019.2.17 using the HDRP.
Everything is working great in the editor, I also can build the game without errors, but when I try to run the built game, there’s only a black screen.
When I check the log files, there are many occurrences of the same error :
System.TypeInitializationException: The type initializer for ‘UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘UnityEngine.Experimental.Rendering.HDPipeline.MaterialDebugSettings’ threw an exception. —> System.MissingMethodException: Default constructor not found for type UnityEngine.Experimental.Rendering.HDPipeline.Lit
We started a new blank project, then we re-installed all the packages (including last version of HDRP) and finally we transferred our files from the old project to the new one.
It seems that the new project is working well. I don’t really know why, but it seems that something was broken in our old project…
We don’t have the time to investigate further, and we just hope that it will not crash in the future with the new project… If someone finds a better solution, well, please post it !
There’s a limit (iirc 4gb) on the asset size for a single scene when building, due to an inherent Unity limit. This usually manifests at runtime as missing/corrupted textures or black environments.
If disabling things is ‘fixing’ it, then it’s possibly the cause.
The solution (other than careful UV mapping and a conservative approach to adding new textures) is to use multi-scene editing to split large environments into subscenes, since each subscene has it’s own 4gb limit.
This is now back for me, cannot get a build to work just shows black screen, this error repeats over and over:
MissingMethodException: Default constructor not found for type UnityEngine.Rendering.HighDefinition.Lit
It seems to break the game entirely!!! Did you ever find a fix?
WindowsPlayer(DESKTOP-2HJNKPC) MissingMethodException: Default constructor not found for type UnityEngine.Rendering.HighDefinition.Lit
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in :0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in :0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in :0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in :0
at System.Activator.CreateInstance (System.Type type) [0x00000] in :0
at System.Linq.Enumerable+WhereSelectArrayIterator2[TSource,TResult].MoveNext () [0x0003a] in <47b3b0cd83a341918376e9dfe8fbc1f8>:0 at System.Linq.Enumerable+<CastIterator>d__341[TResult].MoveNext () [0x0005f] in <47b3b0cd83a341918376e9dfe8fbc1f8>:0
at System.Collections.Generic.List1[T]..ctor (System.Collections.Generic.IEnumerable1[T] collection) [0x00077] in :0
at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) [0x00018] in <47b3b0cd83a341918376e9dfe8fbc1f8>:0 at UnityEngine.Rendering.HighDefinition.HDUtils.GetRenderPipelineMaterialList () [0x00023] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\RenderPipeline\Utility\HDUtils.cs:110 at UnityEngine.Rendering.HighDefinition.MaterialDebugSettings.GetAllMaterialDatas () [0x00001] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\Debug\MaterialDebug.cs:232 at UnityEngine.Rendering.HighDefinition.MaterialDebugSettings.BuildDebugRepresentation () [0x00011] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\Debug\MaterialDebug.cs:274 at UnityEngine.Rendering.HighDefinition.MaterialDebugSettings..cctor () [0x00065] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\Debug\MaterialDebug.cs:152 Rethrow as TypeInitializationException: The type initializer for 'UnityEngine.Rendering.HighDefinition.MaterialDebugSettings' threw an exception. at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at UnityEngine.Rendering.HighDefinition.DebugDisplaySettings+DebugData..ctor () [0x00058] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\Debug\DebugDisplay.cs:218 at UnityEngine.Rendering.HighDefinition.DebugDisplaySettings..ctor () [0x00203] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\Debug\DebugDisplay.cs:335 at UnityEngine.Rendering.HighDefinition.HDRenderPipeline..cctor () [0x001b8] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\RenderPipeline\HDRenderPipeline.cs:270 Rethrow as TypeInitializationException: The type initializer for 'UnityEngine.Rendering.HighDefinition.HDRenderPipeline' threw an exception. at UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset.CreatePipeline () [0x00000] in C:\gd21\gendolp\Library\PackageCache\com.unity.render-pipelines.high-definition@11.0.0\Runtime\RenderPipeline\HDRenderPipelineAsset.cs:43 at UnityEngine.Rendering.RenderPipelineAsset.InternalCreatePipeline () [0x00004] in C:\buildslave\unity\build\Runtime\Export\RenderPipeline\RenderPipelineAsset.cs:10 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) UnityEngine.Rendering.RenderPipelineAsset:InternalCreatePipeline() (at C:\buildslave\unity\build\Runtime\Export\RenderPipeline\RenderPipelineAsset.cs:18) UnityEngine.Rendering.RenderPipelineManager:PrepareRenderPipeline(RenderPipelineAsset) (at C:\buildslave\unity\build\Runtime\Export\RenderPipeline\RenderPipelineManager.cs:129) UnityEngine.Rendering.RenderPipelineManager:smile:oRenderLoop_Internal(RenderPipelineAsset, IntPtr, List1) (at C:\buildslave\unity\build\Runtime\Export\RenderPipeline\RenderPipelineManager.cs:100)
(Filename: C:/gd21/gendolp/Library/PackageCache/com.unity.render-pipelines.high-definition@11.0.0/Runtime/RenderPipeline/Utility/HDUtils.cs Line: 110)