using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
Text mytxt = GameObject.Find("Canvas/Panel/Text").GetComponent<Text>();
mytxt.text = System.DateTime.Now.ToString();
}
public void myfun()
{
}
}
=======================================================================
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()
{
Text mytxt = GameObject.Find("Canvas/Panel/Text (1)").GetComponent<Text>();
mytxt.text = Time.time.ToString();
Time.timeScale = 0;
}
}=======================================================================
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript2 : MonoBehaviour
{
public bool timerOn = true;
float time;
// Use this for initialization
void Start()
{
if (timerOn)
{
time += Time.deltaTime;
}
Text mytxt = GameObject.Find("Canvas/Panel/Text").GetComponent<Text>();
mytxt.text = Time.time.ToString();
}
// Update is called once per frame
void Update()
{
Text mytxt = GameObject.Find("Canvas/Panel/Text (1)").GetComponent<Text>();
mytxt.text = Time.time.ToString();
}public void myfun()
{
Text mytxt = GameObject.Find("Canvas/Panel/Text (1)").GetComponent<Text>();
mytxt.text = Time.time.ToString();
Time.timeScale = 1;
}
}
沒有留言:
張貼留言