How to Reuse the Same Widget Instance in Unreal Engine 5 (Instead of Creating New Ones)?

Hello everyone,

I’m currently working on a project in UE5 where I have a PC object that, when interacted with (by pressing “E” when in range of the collider), should display a UI widget. The functionality is mostly working, but I’m facing an issue: every time I interact with the PC, a new widget instance is created instead of reusing the original one. I’d like it to reopen the same widget instance each time instead of creating duplicates.

Setup:

  1. PC Object (BP_StorePC) - This blueprint contains the interaction logic. When the player presses “E” while in range, it should either display the existing widget if it’s already created or create it if it’s not.
  • First image attached (image above) shows the interaction logic where I check if the widget already exists and, if not, create it. However, I’m seeing a new instance each time I interact.


2. PC Widget Blueprint (WBP_StorePC) - Inside the widget, there is a close button that hides the widget.

  • Second image attached (image above) shows the logic inside the widget for closing the UI.

Problem:
After pressing “E” the first time, the widget opens as expected. But each subsequent interaction creates a new widget instance rather than reusing the initial one. I’m seeing from my print statements that a new instance is created every time.

Goal:
I’d like to maintain only one instance of the widget, so that each time the player interacts, it either shows the already created widget or hides it, without creating additional instances.

Any suggestions on how to properly structure this to avoid duplicate widgets would be appreciated!

Thank you for any help in advance!

Check whether there exists a valid reference first.

1 Like

It looks like it solved the issue.

This is what I have now :point_down:

Now when interacting with PC object for the second, third… time it work on the firstly created widget, which is exactly what I wanted.

I have not made any changes in WBP_StorePC.

Thank You very much!

If you’d have any other advice or suggestion I’m more than happy to hear it.

1 Like