Download

Communicating between widget and actor blueprints

I need to send data from a slider widget to the world location of a static mesh or an actor blueprint.

I have the Widget BP set up as follows - with 3 variables - low and high are floats to remap the 0-1 value on the onValueChanged node with the LERP node, SliderValue is the public float variable to communicate with other BP’s

Now, where I’m going wrong :frowning: - I have an actor BP with a static mesh in it (the object I need to control) I have tried this with Set relative location too. The problem seems to be that the static mesh won’t go into the target of the get SliderValue i get - Static mesh component reference is not compatible with slider control reference comment when I try to link it to the static mesh node, I have tried other methods to set the target of the get SliderValue to no avail:(

bb054cb2ba3f7461076107a4933abf217da8904c.jpeg

Knowing my previous experience with starting off with new software I’m sure it is something simple I’m missing - any suggestions?

thanks

I also tried this technique with a stand in static mesh cube referenced in the level BP - still not working :frowning:

377a3da550b76e7aef8f9ca81081696319f5da9c.jpeg

Store a Reference to the desired actor in the Widget BP. You could do this in the GameState if its a Single Player game. Or you could store it in your PC when you Spawn the Actor, and later on upon creating the widget just pass the reference as an exposed variable

Thanks Ruohki

this is for a very simple app to be run on an android device (kindle fire) that you click on a slider to move an object, I wouldn’t even know where to begin with messing around with the GameState, from my limited experience I would have thought that would be overkill for what I need to do (open to correction on that one obviously ). Are widgets so different that you can’t pass data from a slider easily to a mesh or actor BP?

What inputs do you have for your Set World Location node (1st post) and Cast node (2nd post)?

Hi Tearl, thanks for the response :slight_smile:

The only input I need into the actor BP is the Z location, I want to have the X and Y uncontrolled by the BP so I can re position it manually in the perspective viewer. In the first post that’s what I’m trying to do get the remapped value from the public variable “Slider Value” and take that into the Actor BP and map that to the World Z location - maybe I’m being a bit simplistic in my thinking about this. The 2nd post was just one of my numerous failed attempts to do the same thing slightly differently, I thought that might be a better way to input the target into the Get Slider Value node in the level BP by using a placed static mesh in the level instead of a actor BP - obviously a shot in the dark there ;(

I understand what you are trying to do. I know the simple things get me all the time. I asked that question because if there is no input to your SetWorldLocation, it will never execute. I didn’t see an event or call to execute that, so it just stuck out to me.

to pass data to something you must know its address this is why you should store a reference that you can easylie use to access the desired thing you want to move

Thanks guys for the responses, I’ve found a solution using an event dispatcher.

Widget Setup with the OnValueChanged of the slider linked to an event dispatcher with a custom float input to link to the value output.

dd4b0f952e9d472db1c1b05e6cebfb3fad1e7060.jpeg

Actor BP with a custom event and a float input linked to the Z of set world locationZ motion of the

Assigning event dispatcher and linking to Mover_CE custom event from the Actor BP

898589d715cbc58caca599b914c6ed7f6c77fba9.jpeg

this gives the best flexibility as far as I can see, you can set the Low and High float variables to set custom range for the actor BP. It took ages to figure out but as per usual once you understand the principals it becomes a lot easier to get what you need :slight_smile:

ug coregameplay stuff in the level bp ^^

Yeah, I’m sure its not best practice but it does what I need to do with a deadline looming and it is a very simple level I’m designing.