Hello, I have a random number between 1 - 9 of the same Enemy with tags spawning and a collider2D to detect the collisions of the tagged gameobjects but when collided it counts all gameobjects when I only need it to count 1 by 1 no matter the number of objects
private ScoreScript score
void Start()
{
score = GameObject.FindObjectOfType<ScoreScript>();
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.CompareTag(“Enemy”))
{
// This function just adds the texts int value intValue += 1;
score.Score();
}
}