In UE5, I am simply unable to change material parameters at runtime for dynamic materials made with Material layers/blends. Changing parameters pre-runtime works and shows at runtime. I have confirmed the values are coming out of the timeline into the set scalar parameter node properly, but not sure how to troubleshoot from here.
Normal Materials/Instances can be changed at runtime.
I am stumped.
Maybe you did but, you need to set the Material Instance Dynamic on your static mesh component. Otherwise the static mesh still uses the non-dynamic material
Appreciate the response! Yes, I’ve tried setting the material in construction using both types of dynamic material nodes. I even set the mesh material to the instance, and the skeletal mesh itself to use the instance (pre-dymanic of course). So I think yes if I understand your question right.
Whole construction setup:
Right click on the node to add a breakpoint and pie to check if those nodes are actually being triggered.
If so, while still in pie, release controll of the character if you’re currently posessing it, and in the outliner select the character => select the relevant mesh component, check if the mid has been correctly assigned in the material slots of that mesh.
If so, you can double click on that mid to see a read only version with all the parameters, so check if the parameters are being set correctly.
Ok so THAT was helpful in a sense. I checked the nodes were being hit, took a peek at the mesh during PIE and saw this as the assigned Material:
I have no idea what that is! Seems like it was automatically generated somehow and its really weird the tooltip related to the map content folder and the field says a generic instance name. Neither make sense, but maybe this is googleable now. Still open for ideas though…
double click it, that’s the data generated by the create dynamic material instance node
Sorry I did that too. My scalar parameters are NOT there.
All of the material layer blend parameters are missing.
that’s most likely because they aren’t being assigned to.
put a breakpoint on the set scalar parameter value node.
The node does get hit: Breaktpoint:
…but nothing is ever set checked the material multiple times while stepping through. I did notice at the bottom here that the parent is the instance itself. Should it be the master?
ok, expose the variable Exoskeleton Eye Material Ref, and check if on play, the reference in there is the same as the reference in the material slot of you rmesh
They do match, although still that generic name I don’t know the source of…maybe unreal just renames things at runtime.
Also I did check the reference and the Scalars ARE set in there properly. The timeline moves it from 0 to 1.0.
That tells me that exposing it allowed it to be written? Ran a print screen on the node as well and it ran it to 1.0 as well. So the instance has the correct parameter and value, but no change in material.
Then they are not the same.
They just happen to have the same name.
Are both of these happening on runtime? or are you creating the mid on construction?
Creating it on Contruction. Let me move it to Begin play and see.
Moving it all to Begin Play - Exosekelton Eye Material Ref never gets set. Interesting.
Quick follow up on this. I returned for now to a Function in Mat setup with layers driving the functions. All work with run-time parameters updating.
Would be real interested in anyone willing to share a running parameter change setup for pure Material Layer/Material Blend in a master Material setup.
^ Master Mat Setups