Collision Counter +1 To Counter Only Once When Collided

Hello, I have a counter in my game. Every time my Player collides with one of the 47 game objects l want my counter to have another count added to it. I can do this, however what l can’t do is make it only happen once. For example, When my Player collides with GameObject1, this adds 1 to the counter and when he collides with GameObject2, this adds one to the counter, but when he then collides with GameObject1 for a second time the counter does not move, the score does not go up one. I would appreciate the help if someone could show me, thank you.

  • Cameron

You can put the collided game objects into a list. When the player collides with one of the 47 objects, loop through the list to see if it is in the list already. If it is, don’t add to the counter. If not, add to the counter and add that game object to the list.