using UnityEngine;
using System.Collections;
public class Text3dScript : MonoBehaviour
{
float startTime;
TextMesh textMesh;
public static float timer = 60;
void Start()
{
startTime = Time.time;
textMesh = this.gameObject.GetComponent<TextMesh>();
}
// Update is called once per frame
void Update () {
float guiTime = timer - (Time.time - startTime);
if (guiTime > 0)
{
int minutes = (int)(guiTime / 60);
int seconds = (int)(guiTime % 60);
int fraction = (int)((guiTime * 100) % 100);
textMesh.text = string.Format ("{0:00}:{1:00}:{2:000}", minutes, seconds, fraction);
}
}
}
my TriggerScript is
using UnityEngine;
using System.Collections;
public class triggerScript : MonoBehaviour {
void OnTriggerEnter(Collider c)
{
Text3dScript.timer += 20;
}
}