How To Prioritize Between 2 Interactions Happening At Exact Same Time?

I have a specific question, that when player is getting close to 2 nearby interactable objects, and overlapping with both of them. By pressing interact button it’ll trigger the event for each one. But in my case I want my character to interact with one object first, after it’s done, then press interact again to interact with the second object, with no particular order.
How should I set up something like this? Any hints is much much appreciated.

I just asked a question the same as yours but from another perspective… but I think the problem is the same… please let me know if someone solves your question. I’ll let you know if someone solves mine. Thank you so much!!

You could add a priority integer to the interactable objects.

You select the object with the highest priority number and reset it to 0.
If the objects have the same priority you select a random one.
increment the priority number by 1 on the remaining objects.

Someone answered my question and explained what was really going on.

Maybe his answer will be useful for you too

Maybe don’t use player overlap to determine what to interact with, use line trace?

In first person it would be whatever is under the reticle. In a mode with a mouse pointer it would be whatever is under the mouse pointer. Then there is no ambiguity.

That’s a simple and good option, thanks for mentioning!

Thanks for the hints, but would like to know more detailed process about how to set it up, if it’s not too much to ask? Especially I have no idea how to make 2 interactable actors communicating each other regarding the priority stuff.
Thank you.

Basically every Tick() youll do a line trace from your camera through the center of the screen. Then figure out what you hit.

The function LineTraceSingleByChannel :

UWorld::LineTraceSingleByChannel | Unreal Engine Documentation