Can I bind a Dynamic Material Instance parameter to a variable for automatic updates?
Is it possible to bind a variable in a class to a dynamic material instance parameter so that changing the variable automatically changes the material instance?
I have a pawn with a dynamic material instance that has color parameter, and I want that color to be reflected by a LinearColor variable stored in the pawn, similarly to how you can bind a function to a LinearColor attribute for a Text component in a Widget and then whenever you change the variable the text also changes its color automatically.
Or is the only way to do this to make an event fire off whenever I change the color variable and then manually set the dynamic instance parameter value whenever that event fires?
asked Feb 28 '18 at 03:07 PM in Blueprint Scripting
You'll have to create an event, or alternatively, use a material animation curve that's named the same as the material parameter.
answered Feb 28 '18 at 03:27 PM
Not directly... but if you want it badly, you can create a variable that has Replication setting set to RepNotify (it is a networking tool). Then, inside the OnRep_variableName function you can call the event to change specified material parameter.
Whenever you use "set" operation on this variable, the OnRep function will fire. Note: increment/decrement will not fire this event, but you can set the value of variableName with the value of variableName ;)
Follow this question
Once you sign in you will be able to subscribe for any updates here