2016年10月14日 星期五

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 (1)").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").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;
void Start(){
if (timerOn) 
{
time += Time.deltaTime;
}
Text mytxt = GameObject.Find ("Canvas/Panel/Text").GetComponent<Text> ();
mytxt.text=Time.time.ToString ();
Time.timeScale = 1;
}
public void myfun()
{
Text mytxt = GameObject.Find ("Canvas/Panel/Text").GetComponent<Text> ();
mytxt.text=Time.time.ToString ();
Time.timeScale = 1;
}
void Update(){
Text mytxt = GameObject.Find ("Canvas/Panel/Text").GetComponent<Text> ();
mytxt.text=Time.time.ToString ();
}

}

沒有留言:

張貼留言