How to get a variable from a widget

I want to be able to get a variable from one widget to another yet i don’t know what object to set it to please help!!!

With “Get player controller” or “get owning player”, you can find “Get Hud” :wink:

I tried both ways and i’m getting nothing but warnings…

Sorry I didn’t saw that your “PauseMenuHUD” was a user widget ^^’

If they have the same owner (set with “owner” node in the spawn function) this owner can have a reference (variable) to retrieve the other widget.

It will looks like “Widget 1 → owning player → widget 2 reference”

I do this in my project :wink:

can i see how your doing this? Thanks for all your help so far !

1 : In my PlayerController, I have these variables :

110496-606871variable.png

where variable type is the name of the widget you want to access

2 : In my PlayerController again, I spawn blueprint like this

110497-696275widgetcreation.png

it’s important that the 2 widgets have the same owning actor, it’s easier to communicate after. Self means this actor running this blueprint.

3 : In my Widget Multijoueur I have this function :

Where I can access widget score variables, even set them, and I can call the functions in widget score, it’s better to use is valid to be sure that the widget exists in this reference.

I can add more details if you need :wink:

i can’t see the pictures could you please try to import them again? thanks you everyone for the help!!!

post edited, you may be able to see them now :wink:

yes indeed thank you i’m sorry for asking so many questions hahaha but when you get this PlayerController did you create it as a blueprint or are you actually getting a reference from the player controller???

i want to know how you created the variables in the player controller

If I understand the question, the “Get Owning Player” node refers to the “self” connected to the “owning player” in widget creation. The player controller spawn because it’s my default controller in my game mode. So it may be a reference to the controller. (All of this is blueprint only)

with your var selected, just change from “boolean” or “string” (I don’t remember the default one) to your widget name, the best is strart typing it in the search field, it will appears if all is fine. The type of the variable is the name of the widget blueprint

Use get all widget of class (u will get an array of widgets)