Game Development Reference
In-Depth Information
Now, connect the static mesh to be the target and drag a line out of
Return Value
of the
Create Dynamic Material Instance
node. From the context menu, select the first option,
which is
Promote to a Variable
; this will add a variable to the left-panel list. Feel free to
give it a name you can recognize, which, in my case, is
thisColor
. Now, the whole thing
should look like this:
Now that you've created the dynamic material instance, you need to set the new color for
it. To do this, you need to go back to the event graph and start adding the logic for it. I'll
add it to the ball also, and you need to apply it again in
Event Graph
of the
platform
blueprint.
Add an
Event Begin Play
node, which is responsible for the execution of some procedur-
als when the game starts. Drag a wire out of it and select the
Set Vector Parameter Value
node that is responsible for setting the value for the material.
Now, add a reference for the
thisColor
variable and connect it to
Target
of the
Set Vector
Parameter Value
node. Last but not least, enter
Parameter name
that you used to build
the material, which, in my case, is
BaseColor
.
Finally, set
Value
to a color you like; I picked yellow for the ball. Which color would you
like to pick?
Search WWH ::
Custom Search