Download

Remove Widget on button press, I absolutely don't get it

Please check the screenshot.

I want to do something super simple - I want some text to appear when I press E - this works.

Then I want the text to EITHER stay for a few seconds (like you can see there with the delay) OR to disappear when the player presses the left mouse button.

But I don’t get how I get this mouse button in there, since I can’t hook the line up with it. I can only start a new event with it, and there it does nothing. The widget does not get removed when I press the button, also not
when I remove the delay. It just stays on the screen forever.

What do I have to do so THIS SPECIFIC WIDGET (I have more than this and I don’t want all of them to get removed) gets removed when pressing left mouse button?

Are you sure the LMB is being fired off? Do you have any other LMB events that may be consuming the input instead of this one? Do you allow player input on this blueprint?

This doc and pic should help you out:
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/ActorInput/Blueprints/

Have you tried to replace “Remove from Parent” with “Set Visibility” (In Visibility: Hidden)?

It’s a different story but I don’t know the rest of your BPs and with “Set Visibility” you can get what you need…

I can try another button instead of left mouse button, but the input should work since I didn’t disable it and pressing E for interaction works fine.

What does remove from parent even mean? What is even the parent?

Each widget is attached to some kind of parent.
If you have a horizontal box, and put things into that box, then these things are its children and the box is the parent.

After your ‘create widget’ function, is the output of that plugged into a ‘set Text Widget Var’? You need to store a reference to the widget you just created into a variable so that later you can plug said variable into your ‘remove from parent’ function.

Input best handled in PlayerController or Pawn.

For example, create widget in PlayerController and store reference to it.

When button clicked, hide widget.

It works now. The problem was that the blueprint was not getting input from the Player Character.

I know, but I can’t really wrap my head around how to do it yet. I always want the text on the screen (imagine as subtitles) to be removed when I click, and replaced with the next bit of text, and I don’t know how to systematically do this yet.

Now I got another problem - I am using a 3d widget as component of a blueprint actor. There’s also a function called “Toggle UI”, it basically just makes a symbol appear over the object when you’re in a trigger zone.

The function is in the actor blueprint and I am using it in the actor blueprint to toggle the symbol and it works. But I also want to use it in the widget blueprint, because the moment the text disappears from the screen, which is handled in the widget event graph, I want to toggle the symbol (the UI).

It means an eye-symbol appears over an object when you’re close enough, telling you you can interact with the object, when you press E the subtitle appears (the text widget), now the moment the text disappears, I want the symbol back over the object, to signal that the player can still interact with the object.

But it does not work when I call the function from the text widget event graph. I’ve tried for 2 hours all kinds of things, also googling other’s problems (but they never seem to have this problem, always with the player character) and I got the feeling the solution is either very simple or it does not work at all.

I’ve tried plugging into “target” everything you can imagine (the interact_UI component from the other blueprint, which then required a target itself, ugh, a cast which required an object, the camera, the player, get this, get that, promote to variable) but nothing worked.

Toggle UI function in Widget

Toggle UI Setup in Actor Blueprint

Symbol that appears for Toggle UI when in trigger zone (so you understand what I am talking about)

When this text disappears, I want the eye-symbol back, but it does not work