[4.10.2] Creating (!) a dynamic material instance resets material assignment on instance

Reproduction:

  • Create a blueprint with a Skeletal Mesh

Let’s assume you want to change a material parameter at slot 0. As this doesn’t work automatically, we have to manually create a ‘dynamic material instance reference’ and re-assign it to slot 0 in the construction script:


Now place an instance of the Blueprint in the level and try to overwrite some material assignments:


This simply doesn’t work. The SK component gets immediately reset when trying to assign another material to any slot. The reason: As soon as the CreateDynamicMaterialInstance()-Node fires, the whole material assignment is being reset to the class default. Why?

Hi -

Thank you for your report. I was able to reproduce what you are describing on any Mesh Asset in a Blueprint actor and have entered the bug report as UE-25966. I will keep you informed as we investigate the correct solution for this issue.

EDIT/UPDATE: This issue came back as Won’t Fix. The Construction Script runs after the per instance setting of the Blueprint Actor. In order to achieve what you are wanting to do you would need to add logic to the Construction Script like if Material is not set then…

Thank You again -

Eric Ketchum

Thank you, but I don’t really get this… So this basically means you can’t overwrite any material setting in the editor on a per-instance-level if you need to drive their materials parameters later on (for what you have to create a dynamic material instance reference)?

EDIT: I could work around this issue by creating the reference in BeginPlay() instead of the construction script which doesn’t seem to reset the material assignment.

Hi -

I would setup a series of Material Variables in the Blueprint’s Construction Script which allows you to set the per-instance Material settings for your Mesh’s Material IDs.

Blueprint Construction Script:

Per-Instance Settings:

Hopefully this will allow you the functionality you are looking for. I have also attached a Test Project below.

Thank You

Eric Ketchum

[Test Project 4.10.2][3]

Hi Eric,

many thanks, that’s a valuable workaround, good to know. Thanks for all your efforts, appreciate that. Incredible support. :slight_smile: