Draw Material to Render Target doesn't work in begin play (standalone)

Hello there,

I discovered that the draw material to render target function (new in 4.13) doesn’t properly execute when used in begin play.

Note that it works in editor but not in standalone or packaged game.

The workaround is to add a small delay in begin play but I still think this should be fixed… there seems to be more inconsistencies in begin play, for example UE-36132.

I don’t think it’s a bug, but on event begin play, some assets are still loading, therefor, sometimes there is not object or material to project on to. In your event begin play try adding a delay before the draw material to render target.

Btw if you set a delay of 0ms, it will delay it one frame.

I shouldn’t have to add a delay though, the engine should take care of asset loading and whatnot before executing begin play.
Plus it’s inconsistent between editor and standalone so I would say that’s a bug.

True, but does a delay actually fixes it in the first place? Just try it to know if that is the source of the problem

Hello Tk-Master,

Can you provide me with some screenshots of your setup as well as some steps so I can reproduce the issue on my end?

I ran some simple tests and did not get the same results. Below are the screenshots of my blueprint and the set up I used.

Construction Script

108547-rtbp_constructionscript.png

Event Graph

Event BeginPlay - Standalone

This seems to be working as expected on my end, but let me know if you have additional questions and I will do my best to assist you.

Cheers,

That’s odd… that’s how I have it setup too.
You tried it in standalone right? just making sure.

Yes, I tested in PIE, New Window, and Standalone mode. All worked as expected.

Let me know if you are still unable to get this working and I can provide you with a test project to reverse engineer and figure out the differences.

Thanks,

Alright, so I have uploaded a test project which also includes a packaged version (under WindowsNoEditor folder) just to make sure we are using the exact same thing.

Also I’m using 4.13.0 from the launcher.

If you launch the packaged game (or run the project in standalone) you should see a black mesh (meaning the render target is black/empty).
But if you start the project in viewport play/editor mode you should see an icon painted on the mesh instead.

I have also noticed that if I use a translucent (or alphaComposite etc.) material to draw to the render target then the game doesn’t even start properly (freezes/black screen on startup)… definitely something weird going on here!

If it works for you the same in both modes then this could be a hardware bug/incompatibility(?)… in which case I will try testing this on another machine.

Thanks for your help so far Andrew!

Hello TK-Master,

Thanks for providing the test project as I was able to see what the differences between my own project and yours. I can confirm what you are reporting and have gone ahead and entered a bug report for the issue. You can track the issue following the link below on our new Public Issues Tracker.

UE-36558

Once the issue has been addressed by our engineers, the fix will be added to the release notes for fixed issues within an upcoming full engine or hotfix release.

Let me know if you have further questions or need additional assistance.

Cheers,

I have the same problem in 4.15.1, just a heads up
(edit: if the CanvasRenderTarget2d texture is dynamically created in the blueprint, I don’t have this problem)

The issue tracker (UE-36558) marks the issue as solved in 4.23, but I can confirm the issue is still present in 4.25. If not reproducible, I can upload a sample. The workaround as noted is to add a delay after BeginPlay.