- Home /
I used a GUIText to show the score in my game but it doesn't show my true results
My game is rather simple when I hit a game object named "poinsphere" my score goes up one point but when i run it the score in my GUIText goes up irregularly can someone please tell me what am I doing wrong these are my codes for keeping and displaying the score :
#pragma strict
//THIS SCRIPT AUGMENTS THE SCORE WHEN THE PLAYER HITS A SPHERE
static var score : int=0;
function Start () {
}
function Update () {
}
function OnTriggerEnter (mycollider:Collider)
{
if (mycollider.gameObject.name =="pointsphere")
{
score ++;
//Debug.Log(score);
}
Destroy(mycollider.gameObject);
}
and
#pragma strict
function OnGUI()
{
guiText.text = "Score: "+scoreScript4.score;
}
function Start () {
}
function Update () {
}
Comment
Your answer
Follow this Question
Related Questions
Simple Point system 3 Answers
Score going up every second 1 Answer
Score System help 1 Answer
How can I keep a global score updatable from multiple GameObjects 1 Answer
How to set points back to zero when reload the scene? 2 Answers