Last active
December 22, 2015 15:18
-
-
Save tsubaki/6491370 to your computer and use it in GitHub Desktop.
ゲーム内時間の経過時間を求めるタイマー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Timer : MonoBehaviour | |
{ | |
private float startTime; | |
public float second = 0; | |
void OnGUI () | |
{ | |
if (GUILayout.Button ("Reset)) { | |
startTime = Time.time; | |
} | |
if (startTime != 0) { | |
second = (Time.time - startTime); | |
} | |
GUILayout.Label (second.ToString ()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment