Search Unity

Question Black screen & errors when playing in a build

Discussion in 'High Definition Render Pipeline' started by AlphaDreams, Dec 23, 2019.

  1. AlphaDreams

    AlphaDreams

    Joined:
    Jan 21, 2015
    Posts:
    30
    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.
     
  2. matsakovd

    matsakovd

    Joined:
    May 29, 2019
    Posts:
    22
    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.
     
  3. matsakovd

    matsakovd

    Joined:
    May 29, 2019
    Posts:
    22
  4. AlphaDreams

    AlphaDreams

    Joined:
    Jan 21, 2015
    Posts:
    30
    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 !
     
  5. AwesomeAlexx

    AwesomeAlexx

    Joined:
    Jan 30, 2016
    Posts:
    18
    Hi same issue just send a Bug Report, waiting for details.
    For now my solution was to Disable Managed Stripping Level.
     
    radiantboy likes this.
  6. tuinal

    tuinal

    Joined:
    Dec 14, 2012
    Posts:
    17
    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.
     
    radiantboy likes this.
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    It used to get corrupt after 4 gig, I guess it could now go black, thanks.
     
  8. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Im now under 4 gig (3.8) but my builds just show a black screen :-( Any ideas? Managed stripping is already disabled.
     
  9. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Built in 2021.1.10f, and the black screen error is gone!!!!
     
  10. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    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?

    <i>WindowsPlayer(DESKTOP-2HJNKPC)</i> MissingMethodException: Default constructor not found for type UnityEngine.Rendering.HighDefinition.Lit
    at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <a1dc774e8226455cab90d41efc3f67f1>:0
    at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <a1dc774e8226455cab90d41efc3f67f1>:0
    at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <a1dc774e8226455cab90d41efc3f67f1>:0
    at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <a1dc774e8226455cab90d41efc3f67f1>:0
    at System.Activator.CreateInstance (System.Type type) [0x00000] in <a1dc774e8226455cab90d41efc3f67f1>:0
    at System.Linq.Enumerable+WhereSelectArrayIterator`2[TSource,TResult].MoveNext () [0x0003a] in <47b3b0cd83a341918376e9dfe8fbc1f8>:0
    at System.Linq.Enumerable+<CastIterator>d__34`1[TResult].MoveNext () [0x0005f] in <47b3b0cd83a341918376e9dfe8fbc1f8>:0
    at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00077] in <a1dc774e8226455cab90d41efc3f67f1>:0
    at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[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:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr, List`1) (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)
     
  11. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    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.
     
    Last edited: Jul 3, 2021