x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

alt text

Slider Input (G Slider) alt text

Material Change (Output) alt text

Product Version: UE 4.22
Tags:
sliders.png (5.3 kB)
input.png (125.6 kB)
output.png (56.8 kB)
more ▼

asked May 06 '19 at 01:52 PM in Blueprint Scripting

avatar image

Captain_Natty
6 1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

https://docs.unrealengine.com/en-us/Engine/Rendering/Materials/HowTo/Instancing

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

https://www.youtube.com/watch?v=IVKVXjaT6QM

more ▼

answered May 06 '19 at 03:33 PM

avatar image

Everynone
15.2k 77 26 62

avatar image Captain_Natty May 06 '19 at 05:15 PM

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 alt text Slider Value alt text Exposed Colour alt text

dmi.png (84.1 kB)
slider-change.png (60.2 kB)
colour.png (80.1 kB)
avatar image Everynone May 06 '19 at 05:32 PM

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?

avatar image Captain_Natty May 06 '19 at 05:42 PM

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

avatar image Everynone May 06 '19 at 05:50 PM

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:

alt text

Image from Gyazo

capture.png (198.5 kB)
avatar image Captain_Natty May 07 '19 at 12:13 AM

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

alt text

cube.png (23.0 kB)
avatar image Everynone May 07 '19 at 06:49 AM

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:

alt text

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:

alt text

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

That should be it.

capture.png (78.0 kB)
champ.png (182.4 kB)
avatar image Captain_Natty May 07 '19 at 07:28 AM

Used with Skeletal Mesh was already ticked. I'm working with a cube player: alt text

alt text

player.png (103.7 kB)
cubeplayer.png (10.0 kB)
avatar image Everynone May 07 '19 at 07:34 AM

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.

avatar image Captain_Natty May 07 '19 at 06:21 PM

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 alt text

alt text

mi.png (10.9 kB)
mi2.png (26.7 kB)
avatar image Everynone May 07 '19 at 06:29 PM

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?

avatar image Captain_Natty May 08 '19 at 01:04 AM

Yes I've added it to the world alt text

blueprint.png (145.1 kB)
avatar image Everynone May 08 '19 at 07:02 AM

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

alt text

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

untitled.png (21.2 kB)
avatar image Captain_Natty May 08 '19 at 05:27 PM

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.

avatar image Everynone May 08 '19 at 08:02 PM

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.

avatar image Captain_Natty May 08 '19 at 08:07 PM

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

avatar image Everynone May 08 '19 at 08:14 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question