Cant send from blueprint to widget

I want to avoid casting.

Blueprint interfaces and event dispatchers wont work because you can’t get the reference.

If you use the return value of the create widget node instead, you can only send information once, any ‘set’ that runs after the initial one will do nothing.
So how do you update a variable sent to the widget?

You can save the reference, you must be doing something wrong.
btw casting has nothing wrong besides being faster.
Use interfaces if you need to get variables or call functions from multiple widgets which is almost never the case.

image

image

1 Like

That’s you problem. Set once to assign the reference variable value. Get to talk to the widget later on, as above.

Blueprint interfaces and event dispatchers wont work because you can’t get the reference.

But you do have a reference… you Set it yourself.


You do not need casting, event dispatchers or interface for any of this. It’s just direct comms with a hard reference.

In response to your first part, using get to talk to the widget only works for executive things such as remove from parent. If I want to update the variables inside the widget I must use set. But the problem with that is it only works once.

For the second part, if I were to use an interface for example, I can’t set that reference myself because there is simply no option to select it, see images


1 Like

The script is fine, If this fires only once, the problem is elsewhere. How are you testing it? Is your input even working? It is disabled by default in actors.


The other thing is not an interface. You must first create one, add function, add it to the class:

Add implementation in the said class and, finally, call it using a reference. What you’re showing is a null reference variable. These cannot be filled upfront because the widgets do not exist outside PIE.

I have an interface in the project but ‘finally, call it using a reference’ is the problem. How do I get a working reference to call it if I can’t fill in the reference because it’s a widget.

You’re doing it correctly in the pic you provided. How are you testing it when you say it works once?

For example, I am tick-priting this in the widget:

I have input enabled which works for other logic within that blueprint, but not the widget- the widget has a text box bound to ‘Widget Value’ float but wont receive updates. No matter how many times I press it remains at the first value.

I can get a print string to successfully update the way you show, but no variable inside the widget will do the same.

Like this:

image

Some other way?

Exactly that

How’s this?

It’s set to Allow

It’s not the comms, it’s something dodgy in the widget. Something overrides the value or we’re watching the wrong value. Anything out of the ordinary there? You sure it’s the right var?

How’s this:

Perhaps something gets trimmed? What bothers me the most is that you say it works ONCE. Is it once after the key press?

Yeah I think it’s set up right.
It works once meaning it fully accepts any default value, or the value of another variable and displays that but wont respond to the key press or another changing variable method.

Can we see what’s here:

image

Also find ALL places this variable gets updated:

See what you find. There should be only 2 with this setup.


How many widgets / actors like this do you have?

More than 1?

I made this project anew so there’s not much. Anything other than what you see is either deleted or never used in this one. Happens the same in my other projects. Only 1 widget and 2 references of the variable.


Hit the binoculars to get them all:

This is just this BP.

No change after binoculars

See my replies to Everynone on this

Just to test some things out, can you put this in the widget:

in the actor:

Ignore the binding for now. Does this print?


Another thing, do you ever:

image

Somewhere on tick?