Question by
NotExpected · May 08, 2016 at 05:56 PM ·
c#unity 5score
Problems with GUI Text and adding score to it
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Score : MonoBehaviour {
public Text scorepoint;
static int score = 0;
static int highScore = 0;
void Start()
{
scorepoint = GetComponent<Text>();
}
void FixedUpdate()
{
score++;
if (score > highScore)
{
highScore = score;
}
}
void Update()
{
scorepoint.text = "Score: " + score + "\nHighscore: " + highScore;
}
} I've found this code that was supposed to fix my problem , but apparently not. I want 1 score added every frame, but right now the GUI text doesn't change.
Any help is appreciated
Comment
Didn't notice that, randomly put it there. Thanks
That wont fix the problem tho
I can't find any problems in your code. Except that it's very bad.
Your answer
Follow this Question
Related Questions
Highscore table C# HELP!!! 0 Answers
Objects are created in the same location. 0 Answers
RPC Instantiate issue, Prefabs incompatible with MAC ? 0 Answers