using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Timers;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
Text mytxt1 = GameObject.Find ("Canvas/Panel/Text1"). GetComponent<Text> ();
mytxt1.text = System.DateTime.Now.ToString ("MM/dd/yyyy");
Text mytxt = GameObject.Find ("Canvas/Panel/Text"). GetComponent<Text> ();
mytxt.text= System.DateTime.Now.ToString(" hh:mm:ss");
}
// Update is called once per frame
void Update () {
}
public void myfun()
{
Text mytxt2 = GameObject.Find ("Canvas/Panel/Text2"). GetComponent<Text> ();
}
}
-
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript1 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void myfun()
{
Time.timeScale = 0;
Text mytxt1 = GameObject.Find ("Canvas/Panel/Text1"). GetComponent<Text> ();
mytxt1.text = System.DateTime.Now.ToString ("MM/dd/yyyy");
Text mytxt = GameObject.Find ("Canvas/Panel/Text"). GetComponent<Text> ();
mytxt.text= System.DateTime.Now.ToString(" hh:mm:ss");
}
}
-
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript2 : MonoBehaviour {
public bool timerOn = true;
float time;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (timerOn)
{
time += Time.deltaTime;
}
Text mytxt1 = GameObject.Find ("Canvas/Panel/Text1"). GetComponent<Text> ();
mytxt1.text = System.DateTime.Now.ToString ("MM/dd/yyyy");
Text mytxt = GameObject.Find ("Canvas/Panel/Text"). GetComponent<Text> ();
mytxt.text= System.DateTime.Now.ToString(" hh:mm:ss");
}
}