I have two actors that modify properties of a third actor when they overlap. Let’s say scale and color for example.
This is the case when these three actors overlap at the same time. The third actor is left with mixed properties. Let’s say that with the color that the first actor gave it and the scale that the second actor gave it. (It’s not what I want to happen).
This seems the typical problem that occurs when there is shared memory and multithreading when they are not synchronized. In this case it would be solved using mutual exclusion, semaphores, etc.
I wonder how to solve this problem with events and actors in unreal. Is there a default method to handle it?
In this case, multi-threading tools won’t help you. This is because the overlaps aren’t really happening simultaneously, not in the threaded sense. They may be happening in the same frame but they are still happening sequentially, one after the other.
You’ll likely have to build something on your own, like tracking the most recent actor that made modifications and if it’s not the same one as last time resetting all the shared variables.
Or come up with a different algorithm that doesn’t involve shared state.
Ok, I’ll try to change the logic of the game to try to avoid this situation. Thank you very much for your explanation, it has been very useful for me to know what is really happening.