Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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

OnCollisionEnter2D(Collision2D other)
{
  if(other.GetInstanceID() > GetInstanceID())
  {
    whatever you want to run
  }
}
  
 
PREVIOUS NEXT
Tagged: #run #code #gameobjects #collide
ADD COMMENT
Topic
Name
8+2 =