Override variable in widget from another blueprint


How i do to override one variable in my widget bp from another blueprint ? I´m already try to get reference from my variable “code” in my widget bp (creating one reference from my widget bp variable “code” in a variable called “widget ref”) in my blueprint, and from there, “get code” variable. And, from there, set the “code” and assign my variable “override code” to “set code” node. This variable, “override code” is editable. The “code” from widget bp is editable too. Both are string. But, did not work. Something is missing, because the “code” variable in widget bp remains with the same default value.

Suggestions? Please (:

Can you tell me, Where you have set value for Widget Ref or Blueprint Ref?

You have to set value of your widget reference when you are adding it to viewport. Lets say you are adding it in your Game Mode. Do as below :

And now you have to use this reference using your Game Mode in your BP to set value in your widget.

This will set value in your widget variable.

Create the widget in player controller or character BP. You can access those easily in any BP so, lets say, you can call and promote those widget variables in player controller BP, then get player controller in the other BP you want to change the variable in, get that variable you created and set it to the new value.

Now it works, i did it slight different , because i do this in blueprint actor, not in game mode. I get one reference in my blueprint actor to my widget bp and i get from there my “override code”. However, now i get the error:

" error accessed none “keypadui reference” from node “set override code…”

See below:

Where You have set KeypadUIreference object value?

In my blueprint actor

You have just created an Object of type KeypadUI but you have not set any value into it. So you are facing this “Accessed None” error. You can set this reference when you are creating this UI widget, like I did in my Game Mode as in answer above. Then you can use this reference in your Keypad BP using your gamemode to get access to widget variables, just like the answer posted by me above.

I created one variable, (KeyPadUIReference) and his type i choose my Widget BP (KeyPadUI). The value is automatically set to “none”. How i change that?

Set it in your Game mode BP or your Character BP, wherever you are creating your widget. And use reference from here in your blueprint actors.

Ok…the problem is: i create my widget in my Blueprint Actor…My blueprint actor call the widget , and my blueprint actor set the “code”. How i do that in my blueprint actor? There is no way ? Because when i click in the “default value” of the widget reference, i get no option or asset to choose…

see below:

Can you give snapshot where you are creating your widget.

There is way to use the player controller to create the widget, either with a custom event or a Blueprint Interface.

There Is no way to create my widget in player controller or charcter BP. I need to use my blueprint actor to do this, because using the character bp or anything else directly impacts throughout the structure of my entiry blueprint actor. And is a lot of variables,It is a nightmare, literally.

Set Reference value like this in your Blueprint Actor.

Like this is not functional, because when i star the game, i need to overlap a trigger first, and after that, add the widget. I created a custom EVENT to do this. See below:

I will try to create in that way in character BP with custom events. I let you know the result.

Is this “KeypadUIReference” being used in BeignPlay event? Maybe it is accessing the variable before it is initialised in your custom event.

Yep, i do like this and still get the same error “accessed none”. Before this i do not use the KeypadUIReference in begin play, and the error still coming…

Yep, is triggering because every time i overlap the trigger, thw widget comes in the screen. But, when i stop play, get the infamous error accessed none from…