Unreal Crashes on VR Preview every second time

Hi everyone,

for some reason with my new project I’m working on at the moment, i’ve found it will run the VR Preview the first time no problem, but when I go to run it a second time it crashes. After it’s reopened the project it will once again work the first time but crash the second.

Here is the error it says when it crashes:

LoginId:7b3d65d447d54cfbd0062c99a868f615
EpicAccountId:de923e77ec9c4c6e8e302f1482ba8b43

Assertion failed: !bClearColor || NumClearColors >= BoundRenderTargets.GetNumActiveTargets() [File:D:\Build\++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\Windows\D3D11RHI\Private\D3D11Commands.cpp] [Line: 1823]

UE4Editor_Core!FDebug::AssertFailed() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:414]
UE4Editor_D3D11RHI!FD3D11DynamicRHI::RHIClearMRTImpl() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\windows\d3d11rhi\private\d3d11commands.cpp:1823]
UE4Editor_D3D11RHI!FD3D11DynamicRHI::RHISetRenderTargetsAndClear() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\windows\d3d11rhi\private\d3d11commands.cpp:1204]
UE4Editor_Renderer!FSceneRenderer::RenderDistortion() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\distortionrendering.cpp:1077]
UE4Editor_Renderer!FDeferredShadingSceneRenderer::Render() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\deferredshadingrenderer.cpp:1277]
UE4Editor_Renderer!CaptureSceneToScratchCubemap() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\reflectionenvironmentcapture.cpp:728]
UE4Editor_Renderer!TGraphTask<`CaptureSceneIntoScratchCubemap'::`4'::EURCMacro_CaptureCommand>::ExecuteTask() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:784]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:651]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:560]
UE4Editor_RenderCore!RenderingThreadMain() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:327]
UE4Editor_RenderCore!FRenderingThread::Run() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:461]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

(Can’t put this into a comment due to character limit)

Seems like I ran into a similar issue with 4.18.3, Oculus and a Render Target.
When spawning a CameraMesh that has a RenderTarget attached, it will crash with this log:

Assertion failed: !bClearColor || NumClearColors >= BoundRenderTargets.GetNumActiveTargets() [File:D:\Build\++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\Windows\D3D11RHI\Private\D3D11Commands.cpp] [Line: 1823]
    
    UE4Editor_Core!FDebug::AssertFailed() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:414]
    UE4Editor_D3D11RHI!FD3D11DynamicRHI::RHIClearMRTImpl() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\windows\d3d11rhi\private\d3d11commands.cpp:1823]
    UE4Editor_D3D11RHI!FD3D11DynamicRHI::RHISetRenderTargetsAndClear() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\windows\d3d11rhi\private\d3d11commands.cpp:1204]
    UE4Editor_Renderer!SetRenderTarget() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\rhi\public\rhiutilities.h:405]
    UE4Editor_Renderer!FDeferredShadingSceneRenderer::RenderLights() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\lightrendering.cpp:607]
    UE4Editor_Renderer!FDeferredShadingSceneRenderer::Render() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\deferredshadingrenderer.cpp:1131]
    UE4Editor_Renderer!UpdateSceneCaptureContentDeferred_RenderThread() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\scenecapturerendering.cpp:263]
    UE4Editor_Renderer!UpdateSceneCaptureContent_RenderThread() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\renderer\private\scenecapturerendering.cpp:306]
    UE4Editor_Renderer!TEnqueueUniqueRenderCommandType<`FScene::UpdateSceneCaptureContents'::`12'::CaptureCommandName,<lambda_9b14fd344d5e45a845844385591b130e> >::DoTask() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\rendercore\public\renderingthread.h:190]
    UE4Editor_Renderer!TGraphTask<TEnqueueUniqueRenderCommandType<`FScene::UpdateSceneCaptureContents'::`12'::CaptureCommandName,<lambda_9b14fd344d5e45a845844385591b130e> > >::ExecuteTask() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:784]
    UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:651]
    UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:560]
    UE4Editor_RenderCore!RenderingThreadMain() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:327]
    UE4Editor_RenderCore!FRenderingThread::Run() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:461]
    UE4Editor_Core!FRunnableThreadWin::Run() [d:\build\++ue4+release-4.18+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

Seems like the exact same crash. Are you doing anything regarding additional screens/render targets in your project?

Strangely I am not, I have since found what makes it crash like this but still not why.

I found that If I removed the Light Scenario I had then it would be fixed. I had a simple Day and Night Light Scenarios. When I removed them and baked normally it runs and compiles fine.

Now why this worked I have not a clue

Similarly, my Unreal Editor (v4.19) was crashing when running VR Preview every 2nd time.

Issue:

The source of the issue, in my case, was having in the “Project Settings” the “Default Game Mode” set to a game mode which was used for the default game level in multiplayer environment, meaning it was trying to set up a server/client environment.

Solution:

Edit “DefaultEngine.ini” and modify the line “GlobalDefaultGameMode=[yourGameMode]” to “GlobalDefaultGameMode=None”, or whichever other game mode which would not crash the VR-Preview.

Hello,
Today I packaged a heavy game and the “second” time that I wanted to run it it crashed. (D3D error)
My only option was to restart my PC. Then again, I could only open it once till I restarted the machine again.

Then I realized if I exit epic games on the “system tray” I can run my game for as many times as I want without having to restart my computer. cheers.

Hope it helps you too.

Your comment is out of scope.