I have a strange issue with multiple sets of objects interacting with each other.
I have two objects, let's call them ObjA and ObjB, which are part of a pair. ObjA keeps a reference to ObjB's UID. There are multiple pairs of ObjA and ObjB scattered throughout the layout.
I also have several of another object, let's call it Marker. A pair of ObjA/B are supposed to perform specific actions together when ObjA collides with Marker. The trouble is, it seems that EVERY pair of ObjA/B will perform this action when one touches a Marker. If I delete all but one pair, the remaining one behaves as expected.
This is my code (approximately):
- On ObjA collision with Marker + Pick instance of ObjB by UID stored in ObjA:
- - If Marker.variable = 1: ObjA do thing 1; ObjB do thing 2
- - If Marker.variable = 2: ObjA do thing 3; ObjB do thing 4
Expected: One ObjA touches a Marker and does its thing 1, while its attached ObjB does its own matching thing 2.
Result: One ObjA touches a Marker and EVERY ObjA does thing 1, and EVERY ObjB does thing 2.
How do I ensure that only the ObjA and ObjB uniquely picked at the top are the objects selected in sub events?