How to hide my spawned widget dynamically?

Hello!

I’m working on my first prototype — a simple exploration game with a time loop mechanic. What I coded is a simple countdown mechanic, where the character is teleported back to its original location once my timer ends. Pretty basic.

I’ve recently implemented a Quick Item Use wheel, which works well in the game. However, I only want its widget to be visible on screen under specific conditions, and I’m having trouble controlling its visibility properly/dynamically.

Here’s what I’m trying to do:

  • Show the Quick Item Widget when the player starts a loop (i.e., crosses the loop start collision box). (DONE already)
  • Hide the widget when the timer ends and the player is teleported back to the starting point.

Regarding my current code: The widget is currently spawned using a custom event in my HUDClass, which then calls a function to display it - allowing me to also track my inventory management logic.

Custom event in HUD class:

Function:

And this is my timeloop Blueprint, from which I spawn the widget upon crossing the Loop starter collision box.

In short, I am able to spawn my widget upon starting the timer, but I’m not sure how to properly remove or hide the widget once the player gets teleported back.
I’ve tried using booleans in both Blueprints to track the loop state, but I couldn’t get it to reverse its visibility state.

Is there a way to easily control the visibility of that widget?

Thank you.

I’m not sure what the issue is as you can just remove the widget, but I’ll mention a few things I’m seeing.

  1. In your OnComponentBeginOverlap event, at the very beginning, add an IsValid node (on QuickUseItemSlot variable) into a Branch node. The True branch should continue as usual. The false is not connected.
  2. Your Timer node is set to 1 second and is looping. This is going to cause you issues.
  3. In your timer event, just check if the variable QuickUseItemSlot is set. Use an IsValid node into a Branch node like above, but the True connection goes to a RemoveFromParent node, followed by a SET node on the QuickUseItemSlot variable (leaving the input empty to null it out) and then connect to the rest of the event.

Hi! Thanks for your answer.

My issue is that I cannot find a way to remove the widget only when the timer is over - due to the structure of where my widget is stored (the custom event in the HUD class).

Would you mind also elaboring on the use of a IsValid nod?

For my timer, I haven’t had any issue yet; this is the rest of the code:

Thank you!

Either I’m misunderstanding what your timer is doing or you’re teleporting your character once every second. There’s clearly something not right here that needs to be cleared up.

But your timer is never over. It triggers every second. It is never over unless you manually stop it. Is this where you teleport your character? If so, please show this BP.

I’m afraid I’m not sure how to be any clearer. Check your variable where you store your widget before doing anything with it.

GET(QuickUserItemSlot) → IsValid → Branch → True → Rest of OnComponentBeginOverlap event.

And wherever your timer ends (which it doesn’t right now), do this:

GET(QuickUserItemSlot) → IsValid → Branch → True → RemoveFromParent → SET(QuickUserItemSlot) to null → Rest of timer event.

The input to RemoveFromParent is GET(QuickUserItemSolt).