- Home /
This question was
closed Apr 24, 2016 at 08:59 AM by
tanoshimi for the following reason:
The question is answered, right answer was accepted
Question by
importguru88 · Apr 24, 2016 at 07:33 AM ·
errortimer countdowntimer-script
error : CS1061 Type `int' does not contain a definition for `time' and no extension method
I just trying to display my time test and countdown text together. Looking like this : "Time : 1:00" on the game screen. I gotten an error. Here is some of my code :
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Timing : MonoBehaviour { public static int Time; private float startTime; Text text;
void Awake ()
{
text = GetComponent <Text>();
}
void Start ()
{
startTime = Time.time;
}
void Update ()
{
float t = Time.time - startTime;
string minutes = ((int) t / 60).ToString();
string seconds = (t % 60).ToString("f2");
text.text = minutes + seconds + "Time: :" + Time;
}
}
Comment
you should not be declaring Time
in your code - that's a system variable.
when posting code, please format ALL of it and include complete error messages (including line numbers - that's why formatting is important)