I have a GUI on my scene saying "Capsules Collected: 0/10" and a capsule object which has Collider that whenever the player enters the capsule , the capsule will be destroyed and the Capsules Collected will be increased by 1.
The Destroy Works well, the GUI isnt displaying. What is wrong with my code?
Here's my Code, I assigned this C# script on the Player itself:
using UnityEngine;
using System.Collections;
public class CapsuleGET : MonoBehaviour {
int capscore=0;
void Start(){
}
void OnTriggerEnter(Collider other) {
Destroy(other.gameObject);
capscore =capscore+1;
}
void Update(){
GUILayout.Label("Capsules Collected: "+capscore+"/10");
}
}