I want to change HUD element by pressing key "E" keyboard ,so how can i do this?

i want to change HUD element by pressing key “E” keyboard ,so how can i do this ???

1 . i Create one function ,name is “Mode_Function” in HUD for change element…
2 . than create one blueprint name is “mode”,than try to call function “Mode_Function” of HUD but, it now work

sure thing, first of you are basically there already its just a question about understanding whats happening at this point.

The create widget node spawns a “copy” of the selected class, this is very important to have a firm grasp on when coding in general - you never actually use the specific blueprint you are making, they are always “copied” when they are loaded see.
At this point what we want to have is a reference to that specific copy of the widget. You can get that in this case by draging out a node from the return value of the create widget node and make it a variable - this variable can then be used to “talk” to that version of the created widget, in short making in a reference to that copy of the blueprint.

(beyond here is only extra info)
As a side note you can also make a variable of the correct type yourself, (instead of draging it from the return node), by making a new variable then setting its type to be a reference of your created “display” widget, at this point the variable is setup to hold a reference to the blueprint, but it hasent been set yet - to set the variable drag it out and “set” it like any other variable, note that it will only accept a reference of the “display” widget type, (meaning you need to set it after the created widget node and feed in the return value).

// glhf

You need to cast to the correct reference of your hud widget blueprint, some things you need to do.

get a reference to your hud blueprint into your “mode” blueprint, you can get this from where you add your widget to the viewport for example, (the return node on the “create widget” node you used is a reference to that specific version of the spawned widget blueprint - thats what we need).

drag out a node from said widget reference then “cast” to that type of blueprint, make sure you aren casting to any of the generic types - I would recommend using a more specific name for your hud widget to remove any confusion here, “in_game_hud” or something.

drag from the cast to run your/any event in the cast blueprint.

// hope that helped, glhf

i can understand what you try to say but can’t understand ,how to get references of my hud ,can you explain me in deep ???..ple…!

i can understand what you try to say but can’t understand ,how to get references of my hud ,can you explain me in deep ???..ple…!

Blueprint Communication 101 and Kipplinger gave you a solid Answer just would replace the word “copy” with “instance” and add this Video so you get a good grasp on some Fundamentals.

it’s work but is that any other way to get references of umg or hud…