I’m trying to change the material of a widget component in blueprint. I have try to “Create Dynamic Material Instance” but it’s look like it isn’t working for WidgetComponent. I have correct result if i’m using the interface or if i apply the result on a staticmeshcomponent. If someone have a solution for my problem, i listening
PS : I need a DynamicMaterialInstance to be able to change a parameter.
I’m from Unity and I’m only using Unreal for 2 weeks so i’m open to every solution. My Material is playing with vertex, can i do it if a applying my material to a 2D widget?
Btw: what’s the difference between a 2d widget and a 3 d widget?
No. Definitely no. 2d widget material is exceptionally simplistic.
In this case, find the material the 3d widget is using, make a copy, move it to your project, open that copy and add the code you have in your own material on top everything else it is doing.
This way you’ll preserve the pass through material (there’s like 5-6 different versions there - I think they’re actually dynamic instances, too) and can add your own fancy stuff to it.
Untested, never seen anyone trying to do it. Let us know how (if) it works out!
A bit late, but if anyone else is wondering, it already has dynamic built in at runtime. You just need to give a tiny delay before attempting to use it:
I’m on this issue also. As soon as I apply a Dynamic Material to the widget component, the material goes to default.
from this
to this
A delay is not fixing the issue, as suggested before.
What I’m trying to do is to animate the widget mask with a flipbook. I’m using a copy of the orginal widget master material. Added the flipbook and that’s all. It works PERFECT with a “normal” material instance.
I need to control the flipbook progress from a Level Sequence. That is still not working,
I’ve captured what happens:
It seems the Sequencer animates materials by assigning a new Dynamic Material. Who knows.
But I can use the timeline method above, calling it from a Sequencer Event. Not too bad, and I need this working whatever it takes. I’ll ty it tomorrow.
Hey @Everynone (and to anyone in the future trying to animate widget materials with sequencer), I’ve just found the perfect “hidden” solution on this providential YT tutorial:
In fact, that trick with the name of the function Set+variblename is a HUGE feature to get control on anything from sequencer. Is it documented anywhere?
This way, animate the widget component flipbook from sequencer is as easy as creating a variable and a function, like this:
And that’s all. Just let that variable and function to exist in the blueprint. No Begin Play, Event construct, or any dynamic materials management needed. All you need is in this screenshot.
EDIT: It’s even better: With this method the Sequencer is much cleaner and easy to handle! No need to create a 3-level nested track (Component/Material/Parameter) to access the parameter. Just a single parameter track. This makes your life much easier if you’re working with complex sequences, as I’m doing now,
Awesome! Today I’ve learned something huge for the type of apps I usually do.