Creating Dynamic Material in Construct Script crashes engine at reload

I cannot create Dynamic Material Instance for Text Render Component in my Actor’s Construction Script because it crashes engine when I try to reload the level with the Actor inside.
I can load the level properly for the first time, but engine crashes every time when I want to open it again (via editor).

In [engine log][1] I found an error referring to Material Instance Dynamic for my Component.

Is it safe to create Dynamic Materials in Construction Script?

1 Like

Hello Koralgoll,

I was able to reproduce this issue on our end. It appears that this is a known issue and that it has been submitted to the developers for further consideration. I have provided a link to the public tracker. Please feel free to use the link provided for future updates. Thank you for your time and information.

Link: Unreal Engine Issues and Bug Tracker (UE-29640)

Make it a great day

This is still an issue in BP.

If a material (e.g., DefaultTextMaterial) is assigned to an object material element and then, with “Construction Script” a dynamic material instance of the same material (DefaultTextMaterial) is created and assigned to the mesh again, the editor crashes.

But I have found a solution: First use the default material, e.g., DefaultTextMaterial or BasicShapeMaterial in my case, then create a dynamic material instance of not the same material, e.g., MI_MPR-COR in my case and assign it to the mesh (see figure).

Heya

Just to check, did you solution work for you 100% of the time?

My issue is closer to this:

Its pretty much a crash that is caused by Dynamic Material Instance, that happens when you ESC from the simulation.
However, I could not find a solution yet, so I am trying your solution, even if the situation is slightly different.

Anyways, the solution did not help my situation so I was wondering if I am doing it right, of if the solution works at all. Any info will be helpful.