How Change The Character's Material Via UMG Sliders

The title says it all. I’ve been struggling with this for a while. I’m trying to get umg sliders to individually change the RGB values of the character’s material.

I’m fairly new and I’m half guessing what I’m doing, If someone could help me, it would be much appreciated.

  • thanks

Sliders
276109-
Slider Input (G Slider)

Material Change (Output)

276131-output.png

You need to create an instanced dynamic material with a vector parameter.

A YT example that is probably less convoluted that the docs:

I’ve followed most of the video’s steps but I’m currently stuck. The material isn’t changing colour and I don’t see where I’ve gone wrong.

Dynamic Material Instance

Slider Value

Exposed Colour

Remove the Optional Name - color, this is for material slot assignment (afair) in case you have more than 1 material on a mesh. Not sure what happens if you specify a slot that does not exist.

Is the first 1 screenshot from the widget (where you create the instance) with the slider?

I removed Optional name - color (Nothing happened). Yes, the 1st and 2nd screenshot are in the same widget/blueprint

It shouldn’t matter tbh. Are you sure the Get All node gets an actor that actually exists in the world - consider printing its name just to make sure.

I just dropped this into a clean project:

Image from Gyazo

1 Like

I think I’ve found where I went wrong,
I’ve put Target Mesh not Target Cube,
but I’m having difficulties finding
Target Cube

No, this is just name of the mesh. It can be renamed. However, I assumed you’re just trying to change a color of a mesh. But now I’m pretty convinced you’re trying to recolor the mannequin character that comes with engine’s templates, this champ, right:

276194-champ.png

The mannequin is actually a skeletal mesh and is treated slightly differently. The only thing you’ll need to do is to open the material and tick Use with Skeletal Mesh and Apply it:

276193-capture.png

When you run the project, you may need to wait for the shaders to recompile

That should be it.

I think I’ve found where I went wrong, I’ve put Target Mesh not Target Cube, but I’m having difficulties finding Target Cube

276170-cube.png

Used with Skeletal Mesh was already ticked. I’m working with a cube player:

276179-player.png

276180-cubeplayer.png

So hold on, if you’re trying to change the colour of the cube why did you try to change the colour of the player mesh in the first place?

Untick skeletal in the material, apply the dynamic material to the cube. Done.

I don’t know but I’ve tried Unticking skeletal mesh and applying the dynamic material. Nothing.

I did notice that CubePlayer1(self) doesn’t have a material instance set, I have tried to set it but It gives me no options

276249-mi.png

276250-mi2.png

Can you show your blueprint again - where you create and the assign dynamic material to the Cube;

Also, make sure the object you’re pulling from All Actors node is valid. Did you add it to the world?

Yes I’ve added it to the world

You are STILL trying to change the colour of the Player Mannequin Skeletal Mesh, not the static mesh of the cube…

276304-untitled.png

We’re walking in circles, the correct solution is in the images above. :slight_smile: The very first image I posted.

Thank you, I got it to work. I’m now facing new problems, the player changes back to its original colour when the level changes. Also, the colour change is only client based. I would like it to be server based so other players can see the chosen colour.

You have 2 choices - save the data to a Save Game object or use Game Instance class to store data.

For multiplayer there are plenty of tutorials - search for replication on YT. It might be a bit too much to cover it here.

For saving the player colour, what would require less memory?

It’s just a variable, you don’t need to worry about memory. Not anymore.

If you just want to store a value between levels, use Game Instance. If you want to store it between game sessions (players quits today and loads it tomorrow) use a Save Game object.