You need a variable reference to the mat inst in dynamic form otherwise you can’t change the parameter values on the fly during game play so we must first make a dynamic version and to keep us from having to do that on tick we set it on begin play so it only fires once. The set material node makes sure that the new dynamic version of the material is applied to the static mesh on begin play then using the set vector values we are now setting the Color parameter values of the dynamic material in real time during game play…make sense?
Oh sorry hold down the number 3 and then click anywhere in the graph a vector 3 should pop in right click that node and select convert to parameter, in the details panel change its name from None to Color
I, uh… holding down 3 and clicking on the grid doesn’t do anything different, it just brings up a node browser and fills the search bar with 3’s.
So, let me get this straight; the material is static by default, but we need to make it dynamic in order for it to change during runtime? So that’s what the extra nodes are doing, they’re making the material dynamic?
Not static by default they are just not dynamic they get “ironed” into the scene so to speak during the base pass draw by the cpu and then that information is passed on to the gpu to render out the scene to your screen in a nut shell…roughly speaking. The extra nodes are creating a dynamic version that is part a different pass on the draw cycle, and yes they are making the material dynamic.
Hold down 3 and Left click
or type constant3vector in the search…holding down 3 and left clicking is just a shortcut
Ah, there we go. Thanks.
So, what you’re saying is, they are?
Yes the extra nodes are making the material dynamic
How do you get a reference to the dynamic material within the blueprint of the static mesh?
Okay thanks, just needed clarification.
No, sorry, my question wasn’t quite that complicated. I was just wondering how you introduced a reference node to the dynamic material into the blueprint. ie., how did you create these blue nodes;
Ah, okay. Sorry, I misunderstood your previous explanation. I’m very new to UE and blueprint, if you couldn’t tell.
Its ok, everyone starts somewhere and if you don’t ask questions you won’t get answers.
Thank you very much for your explanation and consistent replies to help me with my problem. I’ve adjusted my blueprint to look like this;
As far as I know, it should have the same functionality as the one you show above. However, the cube’s color still does not change. If there’s anything wrong with the way I’ve laid it out, please let me know.
Yes there is some things wrong the create dynamic material instance node is the wrong one! AH! Drag from the static mesh and then type create dynamic material instance use “gets” in the places I did drag the variable from the panel while holding Ctrl to get a “get” version of the variable, your BP should basically look like mine with only name differences of the materials or variables
Okay, I’ve modified my blueprint to use the version of the Create Dynamic Material Instance node where it takes input from the static mesh;
But why should I be using separate get versions of the variable, rather than referencing them from the set node? It tells me that I can use them in place of get nodes if I want, and in my opinion it looks better and is easier to understand. Is there a logical difference between the two that I’m not aware of?
Also, I’ve run this and it still doesn’t work.