Answers for "run a code only once when two of the same gameobjects collide"

0

run a code only once when two of the same gameobjects collide

OnCollisionEnter2D(Collision2D other)
{
  if(other.GetInstanceID() > GetInstanceID())
  {
    whatever you want to run
  }
}
Posted by: Guest on November-18-2020

Code answers related to "run a code only once when two of the same gameobjects collide"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language