public class GroundTile : MonoBehaviour
{
GroundSpawner groundSpawner;
// Start is called before the first frame update
void Start()
{
groundSpawner = GameObject.FindObjectOfType<GroundSpawner>();
}
private void OnTriggerEnter(Collider other)
{
ScoreManager.instance.AddPoint();
}
private void OnTriggerExit(Collider other)
{
groundSpawner.SpawnTile();
Destroy(gameObject, 2);
}
}
currently everytime the player goes over the object the score keeps going up as they touch the collider for a couple seconds but I just want them to touch it once and get 1 point added to score not multiple. Then move onto the next platform and get another point added.