Changing Material Instance Parameter Value

Hello,

I am in problem. Again!!!

I’ve my pawn and its mesh has a material. In that material I want to change a parameter via blueprint at runtime which I am unable to do.

In my material there is one parameter which I want to toggle.
electric_shock

It was suggested use Set Scalar Parameter Value but I am unable to make it work. Please help me out on this.

You are using the wrong parameter node. The one you are using is for parameter collections. You need to create dynamic material instance for your character mesh, and then set parameter using the output pin of that node. Like this:

72400-matinst.jpg

You’ll just get Set Scalar Parameter node instead of Vector.

But the value I want to change is not getting changed.

Could you show more of your blueprint logic?

Yeah, you need to show us how you are trying to set the parameter.

I am having the same issues as the OP. I am using 4.11.2. I want to set a single parameter of a specific Material Instance, and avoid using Parameter Collections as they are too unwieldy, not to mention converting all parameters in the master Material from Params to CollectionParams makes the value go missing from the Material Instance Editor.

I get a reference to the existing Material Instance in my BeginPlay node and store it in a variable (this seems most efficient if I want to reference it every Tick). Then I am attempting to Set Scalar Parameter, however the only option appears to relate to Parameter Collections, not to values in a specific Material Instance.

I must be missing something obvious. Does UE4 support setting a parameter of a Material Instance via Editor (Param) and Blueprint (ParamCollection)?

Hey thanks for the reply. Isn’t it possible to store a reference to the Material Instance in a variable and use that in the way I am attempting? The MI is created in the Editor (I created the MI as an Asset and then just set that as the Material of an Actor).

EDIT 3 The answer is no. You have to create the MI at runtime in order to make it dynamic (MID) and you can only set the parameter of a MID, not an existing MI attached to an Actor. Strange, but I can cope with that.

My answer below is the answer for you and the OP actually. You need to create dynamic material instance(check out my screenshot) and then use it as the reference to your material. Also, you can do it in Construction Script instead of begin play, then set it as a variable so that you can set the parameter with Tick in Event Graph.