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
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();
}
}
}