using UnityEngine;
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>();
//int c = Random.Range (1,4);
mytxt.text = System.DateTime.Now.ToString();
}
public void myfun()
{
Text mytxt = GameObject.Find("Canvas/Panel/Text").GetComponent<Text>();
mytxt.text = Time.time.ToString();
Time.timeScale = 0;
//float translation = Time.deltaTime * 10;
}
第二個
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").GetComponent<Text>();
//mytxt.text =Random.Range(1,4).ToString();
mytxt.text = Time.time.ToString();
//float translation = Time.deltaTime * 10;
}
}
第三個
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 mytxt = GameObject.Find("Canvas/Panel/Text").GetComponent<Text>();
//mytxt.text =Random.Range(1,4).ToString();
mytxt.text = Time.time.ToString();
}
沒有留言:
張貼留言