Ran into a nasty bug that i traced back to overlap events not being reentrant.
I was handling overlap events and performing logic based on the “other actor” parameter that is passed in. Before the 1st overlap event could complete another overlap event was triggered. This had the effect of overwriting the “other actor” parameter for the 1st event such that when execution switched back to the 1st event it was now using the 2nd event’s “other actor”.
is this normal behavior that events are not reentrant? is there some mechanism or tool like mutexs which can be used to solve this problem? Or some way to make certain events reentrant?
My current workaround is to set a flag to ignore overlap events until the 1st overlap event is completely handled. But that’s not a perfect solution.
Each ‘chain’ of BP code will execute in one frame, unless you use latency ( like a delay node, or any node with the little clock top right-hand corner ).
So the ‘other actor’ reference will be valid for the whole chain of nodes, during that frame.
Obviously, it’s a good idea to get that reference out into another variable or array, if you’re anticipating a high volume of overlaps.
1 Like
Each ‘chain’ of BP code will execute in one frame, unless you use latency ( like a delay node, or any node with the little clock top right-hand corner ).
Good to know. thanks.
So the ‘other actor’ reference will be valid for the whole chain of nodes, during that frame.
I call other events when handling the overlap event. So i suspect that causes the execution to be broken into multiple frames.
Obviously, it’s a good idea to get that reference out into another variable or array, if you’re anticipating a high volume of overlaps.
Is there some standard practice or framework already in place to do this? First thing that comes to mind is push them to a queue (or array like you suggest). Seems like a pain to have to plan and mitigate reentrancy problems for every single event with a queue. Just ignoring it until its a problem seems like a bad idea because this sort of issue manifests in weird ways.
You have to manage it, I’m afraid.
If you think down the line a little, expecting everything to be re-entrant would lead to many absurd situations ![:wink: :wink:](https://d1ap1mz92jnks1.cloudfront.net/images/emoji/twitter/wink.png?v=12)
1 Like