Hi, so what I would do and probably the easiest way is:
-
In your Player blueprint, create a bool var called “Epressed?”
-
No when you press E set that bool to true and when the button is released set it to false.
-
In the desired actor blueprint (Door,Box,Wood etc…) add a Box Collision component. Select that box and in the
Event graph create OnComponentBeginOverlap (OCBO in short) , and OnComponentEndOverlap (OCEO). -
From OCBO cast to your Player and create the desired widget. (Dont forget to add it to the viewport) Now connect Object to Other Actor and from the as Player get your “Epressed?” bool and check if true (With branch). If true do the desired action. If false create a loop.
-
My way of creating a loop is to create a Sequence and a Gate. From sequence connect Then 0 to Open ( so it first opens the loop) and connect Then 1 to Enter. In the Exit Once again check if “Epressed?” is true, if it is true then do the desired action and Close the Gate so it stops looping. If not then make a delay and connect it back to Enter from the Gate. So it loops and checks again.
-
Now from OCEO (OnComponentEndOverlap) just Close the gate. So if the player just walks out of the range without pressing E it will stop the loop.
Let me know if that works for you, and feel free to ask my any questions