I’d like to toggle my UMG authored HUD globally, via a function or console command.
Is there an existing way to do this, or do I need to author something in my blueprint to hide all UMG elements?
I’d like to toggle my UMG authored HUD globally, via a function or console command.
Is there an existing way to do this, or do I need to author something in my blueprint to hide all UMG elements?
May you can add them to an array of Widgets when they are created (added to viewport)
and remove them if they are removed from the viewport.
This array could be stored on your character. Now you could make a button that uses
a flip flop or something like this and go through the array with a for each loop.
I guess you can use a hide function or something from the widget than.
Yeah… that’s what I was hoping to avoid, since the widgets can come from a number of blueprints at any moment. I was hoping there may be a command like “Show UMG” or “toggleui” that would hide everything.
I don’t know if this exists but a widget has an Event that is fired on Construct. Similar to “BeginPlay” it is fired when the Widget is created. So it’s not important what BP creates the widget. You would just let the widget add itself to the array.
If you use “highresShot” or “highresShot 2” in console command, the UMG UI will not be saved! Only the scene render gets saved… Otherwise, within your UMG Widget Blueprint EventGraph, add a CustomEvent by right clicking and typing “Custom Event”, naming it “ToggleMyMenu”. Let’s assume you have 5 images in your UMG, R1 thru R5… See the image attached, you can first get visibility on R1: 2 is Hidden and 0 is visible… then you can set the visibility on UMG:
Now in your Level Blueprint or class blueprint where you create and display the UMG, you need to cast the CustomEvent ToggleMyMenu and tie it to an event like the Key T. see the image attached:
Now, you can toggle the UMG off and on using Key T.
I ended up doing something very similar to this. Not really all that elegant, since you need to manually manage what gets toggled, and I have lots of elements that can spawn at run time. I wish there was a ‘screenshot mode’ type action that just hid everything, but this works for now.
Good to know. I’ve been using nvidia shadowplay to capture footage, and need to suppress the UI for video.
Ahh, I’m on mac so no nvidia:) I updated the original answer for others that may read this post.
I have encountered the same problem as yours . I don’t know if you still remember how to solve it .