implement On Component Begin Overlap + button.

Hello,

Do you know how to implement in Blueprints in Unreal Engine 5 an action that will be triggered when a player enters a collision area (On Component Begin Overlap) on a given actor and then holds down a previously set button? I’m encountering an issue where the action is only triggered upon entry, making it impossible to execute it after colliding with the collider when the button is pressed. How can this be corrected to ensure the action continues to execute while inside the collision area?

Thank you,
M

Hi @Szatan432

It depends on how you want to approach it.

But in your case, you have two different contexts that need to interact with each other. When the player overlaps this actor, the option to activate some function from this actor is enabled, and when the player presses a key, the overlapping actor activates this function.

Considering both requirements depend on the player, you could make it in a way that when the player BeginsOverlap on this actor class it saves the reference in an array, and when the player EndsOverlap, the reference is removed from the array.
That way, when you press the designated key, you can use a foreach loop on all overlapped areas/actors and trigger their functions.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.