How do I set a float from a different blueprint than the one I have it on?

I am new to ue4 and am trying to set a material while I am playing. I have a float set up to change the material depending on the value. In my HUD, I want to create a button that is able to set this float’s value, however, I o not know how to do this and I have fiddled around with casting but it does not seem to be working, any help or images on how to do this is greatly appreciated. SideNote: I have seen all of the tutorials on youtube on how to do this and none of them work for me + I have read much of the UE4 forums and still cannot make this work.

A couple things:

  • do not compare to floats
  • do not change material on Tick

Create a custom event in the object that needs material updating:

And a couple of questions now:

  • where is that object? Did you spawn it? Did you place it in the level blueprint?
  • where is the widget - in which bluerprint was it created

And most importantly, what is the big picture here? What is the relation between the object and the widget? Is it always 1-to-1 exchange or there will be many objects and many widgets?

First off #1, the object in which I would like to change the material of is my third person character, the code for selecting which material to apply is inside of the third person character blueprint. Second #2 the widget for the button is in the actual HUD graph. Third #3 the idea here is to create a system that changes the material of the character midgame and the button for the widget is accessed by a key that brings up a menu in order to select the material. If you have discord and could further help me as I am new to this, that would be greatly appreciated my tag is Travis’ Lamp#0042. If you don’t have time to do this or do not have discord, a response is still helpful, thanks for your help so far.

First off #1, the object in which I would like to
change the material of is my third
person character

Got it, that’s where you want a custom event.

Second #2 the widget for the button is
in the actual HUD graph

Where did you create the widget? At some point you called Create Widget and added it to the viewport right? Where? In which blueprint?

Third #3 the idea here is to create a
system that changes the material of
the character midgame and the button
for the widget is accessed by a key
that brings up a menu in order to
select the material.

Makes sense.

No time for Discord, sorry.


Following up on the #3 - if the widget is supposed to do something to the 3rd person character, the widget should be created in 3rd person character.

I created the widget in thirdpersoncharacter

I think I may have solved my issue, I played around with it for quite some time and I believe I have a working method

Here’s the whole thing, just in case:

The widget with an Event Dispatcher sends the material onClick:

And the Player Character is catching what the widget sent:


Now that we know how it’s supposed to work, the above method is more sensible.


I think I may have solved my issue, I
played around with it for quite some
time and I believe I have a working
method

Nice, good luck!

thanks! Appreciate it :slight_smile: