Collision task

Hi developers!

I have two game objects. Each of them has script with some parameters, which could be different or same. If they collide each other, those parameters has to be changed (depending on those parameters btw). The code, which doing it, is in OnCollisionEnter().
My trouble is that OnCollisionEnter() fires twice - on first object and on second, so it changes those parameters twice in one collision. How to fix it?

Thanks!

Seems to be more of a logical problem than a technical problem.

You should try to make sure that each object only changes the parameters which are relevant to itself rather than the other object’s parameters.

For a more detailed answer you’ll need to post a more detailed question. :wink:

You could also alter your plan and just let one of the objects (the “Master”) handle the updates for both objects, referencing the collider from the Master object.

Good luck

/Chris