using UnityEngine; using UnityEngine.UI; public class TextInc : MonoBehaviour { public Text scoreText; int score = 0; GameObject prevPlane = null; public void OnTriggerEnter(Collider other) { if (other.gameObject != prevPlane) { score++; scoreText.text = score.ToString(); prevPlane = other.gameObject; } } }