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:
- 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!