# Unity 5 - Time Remaining displaying in scene but not in Game

I'm currently learning game development in Unity from this course on Lynda.com. Currently I'm trying to displaying the time remaining in the game after it has been set to 5 minutes initially. When I look at the scene, I can see the text for the timer displayed in the top left corner of the canvas, but when I run the game, I'm not seeing it at all.

I made a script for a game manager which is derived from a Singleton class. The game manager contains a private variable (and an accessor method) for the time remaining. I have another script that accesses the value for the time remaining and displays it on screen. In the Unity editor, I added a UI game object for the text box and then added the text box to the GUI representation of the timer label attribute. It seems like everything should be working but since I'm still very new to this, I'm probably missing something simple. Here is the code for both scripts:

GameManager.cs

public class GameManager : Singleton<GameManager> {
private float _timeRemaining;

public float TimeRemaining
{
get { return _timeRemaining; }
set { _timeRemaining = value; }
}

private float maxTime = 5 * 60; // In seconds.

// Use this for initialization
void Start () {
TimeRemaining = maxTime;
}
// Update is called once per frame
void Update () {
TimeRemaining -= Time.deltaTime;
if(TimeRemaining <= 0)
{
//Now Deprecated
TimeRemaining = maxTime;
}
}
}


UpdateUI.cs

public class UpdateUI : MonoBehaviour {

[SerializeField]
private Text timerLabel;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
timerLabel.text = FormatTime(GameManager.Instance.TimeRemaining);
}

private string FormatTime(float timeInSeconds)
{
return string.Format("{0}:{1:00}", Mathf.FloorToInt(timeInSeconds / 60), Mathf.FloorToInt(timeInSeconds % 60));
}
}


## EDIT:

Canvas Settings in the inspector

Image of the Time Remaining displayed in the scene

• Can you post screenshot of game and your canvas settings? – Hamza Hasan Jan 21 '16 at 21:04
• Is the textfield visible but not updating the text or not visible at all? – Vaillancourt Jan 21 '16 at 22:02
• @HamzaHasan I just added the image – loremIpsum1771 Jan 21 '16 at 22:36
• @AlexandreVaillancourt The textfield is visible in the scene (as seen in the second image) but its not visible in the actual game. It seems that the actual text object itself is not docking to the Screen as every time I try to orbit around it, it appears as though its farther into the scene on the Z axis. I'm not sure if it matters but that could be causing a problem. – loremIpsum1771 Jan 21 '16 at 22:40