Hi
so this is my script
using UnityEngine;
using UnityEngine.UI;
public class DetectCollisionAndUpdateUI : MonoBehaviour
{
public int score;
public Text scoretext;
private void OnTriggerEnter(Collider other)
{
Destroy(other.gameObject);
AddScore();
}
void AddScore()
{
score += 1;
scoretext.text = score.ToString();
}
}
What i basically want is that i need a script which can detect triggers and then increment the score by one if the trigger is triggered
but for some reason it is sometimes incrementing the score by 2 or sometimes by 3 or any other number
Is there any solution if there is please help! also i want it to appear on a ui text thats why i am referencing it too.
PLEASE HELP!