Black screen & errors when playing in a build

Hello everyone !

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

(full stacktrace of the error available here : https://pastebin.com/raw/P3n5HYYV )

I really don’t know how to fix this, and it’s really problematic.

I’m using Unity 2019.2.17f1 and the HDRP package version 6.9.2.

We have a similar problem too. The black screen disappears if you turn off many objects on the scene. I can not understand what it is connected with.

I get this image when disabling a lot of objects

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 !

Hi same issue just send a Bug Report, waiting for details.
For now my solution was to Disable Managed Stripping Level.

1 Like

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.

1 Like

It used to get corrupt after 4 gig, I guess it could now go black, thanks.

Im now under 4 gig (3.8) but my builds just show a black screen :frowning: Any ideas? Managed stripping is already disabled.

Built in 2021.1.10f, and the black screen error is gone!!!

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)

Looks like stripping was set back to high somehow.Will try again with it off. Edit: stripping set to low avoids this and build works.