I am working on a simple timer that is the basis for your score although there is a problem with the code and I don't know why! Can somebody help me figure what is wrong? Here is my code:
using UnityEngine;
using System.Collections;
public class KeepScore : MonoBehaviour {
public static int Score = 0;
double timer = 0.0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
timer += Time.deltaTime
Score += (int)timer;
void OnGUI()
{
GUI.Box (new Rect(50,50,100,100), Score.ToString ());
}
}
}
All in C# of course. (Which I am kind of new to.)
Thanks, and all feedback is appreciated! :)
↧