my hero shoots shotgun it has about 12 projectile they set to trigger.When they enter bandit_score should increase 1 but it increases randomly about 6 to 10 . I had to write banditscorebool to fix it but ı dont understand why it didn’t work without banditscorebool
public void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.name == ("pompali_mermi(Clone)"))
{
GetComponent<AudioSource>().PlayOneShot(hmachete, 0.5f);
Instantiate(blood, transform.position, Quaternion.identity);
if (bandit_health>0)
{
bandit_health--;
}
if (bandit_health == 0 && banditscorebool))
{
banditscorebool = false;
banditscores.bandit_score++;
deaddd = false;
gameObject.layer = LayerMask.NameToLayer("deads");
GetComponent<Animator>().SetInteger("bandit_dying", 1);
}
}