Calling DrawMaterial in a CanvasRenderTarget2D Blueprint crashes in standalone game

I’m trying to make an in-game computer that displays a bash-like terminal, so for the screen part I’m using a CanvasRenderTarget2D, to which I draw text. This works fine, but I need to clear the render target, since it starts out green. I couldn’t find a BP function that clears a Canvas to black, so before going all C++ on this I decided I’d try using DrawMaterial to do the same thing, which works fine in the editor, but crashes the standalone game. The crash reporter even gives a nice stack trace, from which the two top-most lines are as follows:

  • UE4Editor_Core!FDebug::AssertFailed() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\misc\outputdevice.cpp:374]

  • UE4Editor_Renderer!FSceneRenderTargets::GetSceneColorForCurrentShadingPath() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\renderer\private\postprocess\scenerendertargets.h:631]

And checking line 631 of that header-file indeed points to getting the scene color for the current shading path, so obviously something colorful goes wrong when rendering this render target.

Is there a better way to clear a Canvas to a given color, or should this be a bug report, or both, or something else entirely? I could also show you what I’ve wired to what in my CanvasRenderTarget2D Blueprint:

Thanks for any help!

Hello -

This was an issue in 4.10, but has been corrected in 4.11. You can test the fix in your project by copying and trying it in Preview 1 of 4.11.

Thank You

Eric Ketchum

Hi Eric,

I confirm that this works in 4.11 Preview 1. Thank you for your help!