I’m building a popup widget system for my game using the Thirdperson Template and am running into a weird problem.
My setup goes as follows:
BP_Thirdperson uses a linetrace to detect whether I’m clicking on an interactable actor and displays a popup widget.
The code for the widget is in a custom “Interact” event on a “Interaction” Component.
I created a parent BP class for all interactable actors and added the Component to it.
My scene only contains 1 Child Actor with the Interaction Component.
For some reason, even though there is only 1 actor in the level with the component, the Interact event on the Component is being ran twice.
Here are some screenshots to hopefully give you an idea of what’s going on.
This is the part where Thirdperson BP does the line trace
Here it Casts to the Component and if it is valid, tries to run its Interact event:
And here is the Interact event on the Component, for debugging purposes I replaced it with just a print string:
As you see, there is only one actor in the level, BPChild_item, which contains the Component that has the Interact Event. The print string that says “click” is immediately before the Event gets called, and there is only 1 “click” printed, but then 2 “Hellos” gets printed, which seems to suggest the event is called twice. How is this happening?