OnCollisionEnter getting called more than once,OnCollisionEnter called more than once

So my player is moving forward and when it hits an obstacle, particle effect gets activated and i get debug.log sying particle active, everything works just fine except the script is getting called more than once when micro collision happends or my player hits two obstacles at the same time. I tried using a bool but i didnt seem to work, im really new at this so pls help :slight_smile:

bool ObstacleHit = false;

public ParticleSystem crashEffect;

void OnCollisionEnter(Collision collisionInfo)
{
	if (ObstacleHit == false) ;
	if (collisionInfo.collider.tag == "Player")
	{
	    {
			ObstacleHit = true;
		    Debug.Log("Particle Active");
		    crashEffect.Play();
		}
	}
}

bool ObstacleHit = false;
public ParticleSystem crashEffect;

 public void OnCollisionEnter(Collision colInfo)
 {
     if (ObstacleHit) 
         return;

     if (collisionInfo.collider.gameObject.CompareTage("Player"))
     {
         ObstacleHit = true;
         Debug.Log("Particle Active");
         crashEffect.Play();
     }
 }

Try this out