Creating dynamic material from decal resets the decal material, why?

Hi, I’m trying to modify the material of a decal component to change the color using
“Create Dynamic Material Instance” but it only works the first time. The second time I try to adjust the material, it just resets to the “default” one. I’ve been trying for a while to figure out if it’s a problem with my setup or a problem with the engine but I’m running out of ideas so that’s why I’m asking here.

Here’s a video of the effect in action. I have a cone that triggers overlap events whenever it finds a decal and then, grabs that decal’s material and changes its color. As seen, the first time it works, but the second time I try to do the same, the material just resets to the default one.

And this is the code of what I’m doing:

I can’t see what I’m doing wrong, also taking into account it works in normal materials (it can be seen in the video, on the material applied to the cube) and any help would be greatly appreciated. Thanks.

May I see more of the blueprint? Like, more of the context of what you have there?

How about setting the material of the decal to the dmi after you create it.

Its not on the decal.

Hey sure, but there’s not much more to it, that’s why I’m so puzzled about it. This is the missing part:

Hey, yeah, also tried that but it didn’t work. This causes the same effect:

I’m not sure where you are going wrong with this. It works out of the box.


I get a random tint every time I overlap the decal

Hey! Thanks a lot for taking the time to reply so quickly!

It does work indeed. And after doing some tests the main difference is that in order for this to work, the dynamic material creation and modification need to happen inside the decal actor and I was triggering that modification from the colliding actor and getting the collided decal instead of from the collided decal itself directly.

Geez, I wish UE wasn’t so quirky, reminds me of JavaScript :stuck_out_tongue:

1 Like

Well best of luck with further unreal quirks, there are quite a few :slight_smile:

2 Likes