Change a meshes material using Hud Button press

Hi all

I am sure this has been covered before so if someone can point me to the correct answer that would be great.

V simple I have a button created in the my HuD and on button press I want it to swap a material on a mesh. Just to test I would like a two hud buttons one red one blue ( which I have created ) and on press it swaps the box material from red to blue ( for now a colour is fine but I will want a texture swap eventually ) , its just for a proof of concept.

I can swap the materials pressing a keyboard key using one of the old material tutorials but I cant seem to find a new updated one.

Any help would be appreciated


Create the two buttons, add an on click event for each. Start by right clicking and getting player pawn, cast that to your Pawn blueprint, drag off that and get the pawns static mesh, then drag off that and do set material.

Hi Pinworm

Thank your for the reply, How do I create a pawn blueprint for my mesh and then reference it?

Many thanks for the help


For anybody needing help with this here is a great video