run a code only once when two of the same gameobjects collide code example
Example: run a code only once when two of the same gameobjects collide
OnCollisionEnter2D(Collision2D other)
{
if(other.GetInstanceID() > GetInstanceID())
{
whatever you want to run
}
}