2016年11月10日 星期四

========================================================================
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 ();
 }

}

沒有留言:

張貼留言