x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Toggle Visibility of UMG Widget

Hello AnswerHub! I'm a beginner with Blueprints in UE4 and am looking for a bit of help with making a BoxTrigger Set the visibility to my Horizontal Box in my UMG Widget Blueprint. I have in my current Blueprint:

My Level Design BluePrint:

Image 1

This works and prints out "Testing" in the top right.

And here is my Horizontal Box that I want to make visible on pressing space:

Image 2

Can only of you give a detailed explanation of how to set the visibility to be visible?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 19 '15 at 05:55 AM in Blueprint Scripting

avatar image

BMassed
8 2 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hope I don't lose you here, I'll do the best I can to explain.

  1. Create an Interface, call it something like "Widget_Interface";

  2. Go to the Graph of your Widget and select "Class Settings" and under Interfaces select "Add" and locate the Interface from step 1;

  3. Go to the Blueprint that has your space bar command and under "Class Settings" under Interfaces select "Add" and locate the Interface from step 1;

  4. In your interface, and click "Add New" and name it something like "HideHud" - this doesn't need any parameters;

  5. Go into your BP with the space bar event, and in the space bar event, drag off the execution pin and find "HideHud(Message)" (you need to turn off Context Sensitivity to find this);

  6. You need a reference to your Widget (I usually Create all my widgets at Begin Play and store them in variables for uses such as this.) Plug the widget reference into the message call;

  7. Go back to your Widget and in the Designer tab, next to the "Visibility" you see "Bind" (as you showed in the picture above.) Click Bind and select "Create Binding";

  8. Go into the Graph and rename this binding as you see fit;

  9. Drag backwards off the "Return Value" pin of the Binding made in step 7 and select "Promote to Variable". Name this whatever you like, I'll call it "VisibilityVar";

  10. Go to the main Event Graph of your Widget. Right-click and select "EventHideHud" except this time you want to select the one under "Add Event";

  11. Drag off the event from the last step and select a branch node;

  12. Drag/drop the "VisibilityVar" into the graph as a Get node. Drag off the "VisibilityVar" pin and type "==" in the search and select the "Equal(Enum)" option. Leave the default as "Visible" and hook the red pin into the branch;

  13. From the "True" pin in the branch drag off and type "Set VisibilityVar" and change it's value to "Hidden";

  14. From the "False" pin in the branch drag off and type "Set VisibilityVar" and change it's value to "Visible";

Here's a simple image of the last step, I didn't create all the interfaces and such:

alt text

Should be all you need! It's as about as detailed as I can get without doing a video for you or creating an entire new project and ScreenShooting everything.

Hope this helps! If so, I would appreciate it if you could accept the answer by clicking the check mark located under the arrow keys next to the answer. When done correctly, the answer will highlight green! As much time/effort as I put into the answer, an Upvote would be awesome too, but I won't push my luck ;) Any other questions just let me know.

visvar.png (69.5 kB)
visvar.png (76.9 kB)
more ▼

answered Aug 19 '15 at 06:41 AM

avatar image

jtsmith
1.4k 70 29 92

avatar image jtsmith Aug 22 '15 at 03:28 AM

Here's a short video tutorial on interfaces, maybe give you a little more insight on them:

https://youtu.be/ZhP-45bw0LM

avatar image RJHelms84 Nov 28 '15 at 12:37 AM

You don't need to do all that. You just need to create a new variable in your character blueprint of the type ESlateVisibility, and then bind to that new variable on your widget's visibility property.

Then you can manipulate it from your character blueprint with ease.

avatar image Sash_dog Jun 23 '17 at 12:05 AM

I would really appreciate a more detailed description of how to "bind to that new variable on your widget's visibility property" if at all possible @RJHelms84

avatar image Silex Apr 11 '16 at 11:32 PM

Thank you very much for your answer! This definitely should be accepted. Even if @RJHelms84 highlighted that the desired result is achievable in a faster manner, I think this is a really nice solution pointing out some usage of the Blueprint Interface and might be more scalable in a longer run.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

@jtsmith I know this is post is answered, but I wanted to piggyback off of your suggestion. I am working on a multicharacter RPG, and am applying what you suggested. How would I use this so it hides the ability widgets for other characters but displays the current characters ability widget?

more ▼

answered Jun 04 '17 at 10:39 PM

avatar image

bcValor
1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question