“The component with the Text I need”
using UnityEngine.UI;
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Countdwn : MonoBehaviour {
public float cntTime = 300f;
public float seconds, minutes;
public Text timeText;
// Use this for initialization
void Start()
{
timeText = GetComponent<Text>();
}
void Update()
{ cntTime -= Time.deltaTime;
minutes = (int)(cntTime / 60f);
seconds = (int)(cntTime % 60f);
timeText.text = minutes.ToString("0") + "." + seconds.ToString("00");
print(cntTime);
if (cntTime < 0)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
“The End Game Display Text”
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FinalScore : MonoBehaviour
{
public float cntTime;
public Text timeText;
public void Start()
{
timeText.GetComponent<Countdwn>
}
void Update
{
get
(cntTime).Text
}
}
Essentially what Im trying to do : I have a countdown timer in-game thats runs down to 0 and then restarts my game. This timer also displays its time as a Text to make it visible in-game. I want the same time to display on a separate text. Letting the player know what time they finished at.
I apologize if this is confusing as for I’m very green to this and I truly appreciate the help ahead of time.