DynamicMaterial breaks DecalComponent
I have an Actor that I've defined in C++ with a UDecalComponent. The material I'm using has some parameters that I want to change dynamically, so I create a DynamicMaterialInstance in the OnConstruction function of my actor:
I've found that if the actor is already placed in the level before I add this code, it works perfectly fine
But if I run the editor with that code snippet it just displays a grey-green texture instead
I was able to repro this with a new project using the simplest material I could think of
It seems the problem lies with creating the DynamicMaterialInstance in the construction script but I'd like the decal to be accurate when viewing the level in the editor window and not just when playing the game.
asked Nov 20 '15 at 10:53 PM in Bug Reports
Hi kgamble -
In your BP project, the Material you have used to create a Dynamic Material from is not set to be a Decal Material in the Material Attributes. This is necessary even if you are using a Dynamic Material Instance.
If you go into the Decal Material and Change the Material Domain from Surface to Deferred Decal, your Blueprint project will work correctly.
In your code project you have actually set up a Dynamic Material Instance but you have not told the MID exactly what Material to be created from. If you want that to be exposed you can create a variable linked to the UMaterial property in code that you can assign a Decal Material in the Editor. Currently you have only a MID that can be assigned, with no way to link a base material to it.
answered Nov 30 '15 at 03:13 PM
Lovecraft_K ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here