Detect only first collision with every object with the same tag.

Hi, everybody. Google didn’t help me. 2d Game. The ball falls down with the platforms. I have a “Player” object and a prefab with a “platform” tag, prefabs are generated randomly. I need to determine only the first collision with each platform. It happens so that the object is faced several times while on the one platform.

Setting the FLAG here will not help because prefabs have the same tag. Detection a collision once per unit time also does not solve the problem.

Can anyone help?

You can store an array or list of items that touched the platform already and check if the colliding object is contained in those lists. This could get cpu intensive though.