In my (multiplayer) game I have a set of balls which save a reference to the player they were hit by (PlayerRef). When a ball hits another ball, this reference gets passed in the Hit-Event to the other ball (and vice-versa).
The “vice-versa”-part is my problem. If I set the PlayerRef of Ball2 to the value of the PlayerRef of Ball1, the original value fromm Ball2 gets lost and I can’t in turn give it to Ball1. So I have a second reference in each ball (PlayerRefNew) I put the references in when they hit another ball. But now I need to put the value of PlayerRefNew into PlayerRef at some point.
My question is: when and where? Is there an event I can call after all Hit-Events of all balls have been executed?
Thanks in advance for all answers.