Blueprint disappear

So I am pretty new to this and I have some problems with Blueprint Visual Scripting. I want to do things but I can’t find a way to do them. I think they should be simple, but anyway, here comes the introduction and the question:

First the player overlaps a trigger box and that makes a widget appear. The widget is an image that says you should press E to interact.

I want the widget to appear with a fade or with an animation, instead of suddenly and immediately. It would be great if it disappeared the same way.

For now, it disappears when the player stops overlapping, but then it reappears when it overlaps again. Now, it would be fantastic if the widget disappeared forever when the player pressed E. It would also be fantastic if once that happened, the blueprint was no longer usable again (that means, if the player pressed E, nothing happened “currently when the player presses E while overlapping a sound is played”)

Thanks in advance!

Widget fade in and out:

In the widget, you can create animations (by default animations tab should be in bottom left corner in designer, if it isn’t there, you can open the tab from window->animations). If you want the entire widget to fade in/out, the simplest way is to add an animation for the root canvas panel (or whatever you have as root) and change it render opacity. You can use a single animation for fade in and out, just play in reverse for fade out. Just as on screenshot

Fade in can be played on construction of the widget, whereas instead of destructing fade out outright, you can play the fade out animation and destruct it once it finishes (e.g. as on screenshot). On the screenshot I have used delay to wait until anim finishes, but you can use animation finished delegate as well.

Only once for the trigger/blueprint once pressed E

Depends on your setup, e.g. is the trigger inside blueprint, is it standalone trigger on level, etc.
You can do this in many different ways, but the most common would be:

  1. Keep some sort of state, e.g. when you press E, check was pressed boolean and only activate it if it was not pressed yet. Upon activation, set the “Pressed” boolean to true. Same with the widget, if player already pressed the E, don’t show widget.
  2. Do once node is nice, but I reckon it won’t do much in this case.
  3. Disable the trigger, so it no longer triggers events on overlap. E.g. change it collision preset to no collision or remove it from the world.
1 Like

Okay, been nice until here:

The thing is what should be main blueprint contain in order to destroy this but also use the animation? Because I am currently using Remove All Widgets when the player is no longer overlapping the trigger box and it doesn’t show up the fade in reversed.

I must say that it does show the fade in normally when the player first overlaps the trigger box.

And on the second point about only once, I want to do the third option but I don’t know how to disable the trigger or, as you say in the example “change it collision preset to no collision or remove it from the world”… How would I do that?

Thanks in advance.

  1. When you use remove widget, it will instantly get rid of it, that’s why in the screenshot we do this after the animation (remove from parent). Instead of using destruct and remove widget, add custom event (e.g. fade destruct) and call it instead. The widget will fade out and get destructed at the end by RemoveFromParent.
    2.1 - Removing from world, there are multiple ways to do this, but basically, get a reference to the trigger and call destroy actor
  • Disabling collision, you can use SetActorEnableCollision on the trigger actor.

You can get a reference to the trigger from overlap, set a reference to it somewhere or add reference from level to level blueprint (select in editor and "add reference to: " by right clicking in level blueprint)