Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active December 22, 2015 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/6491370 to your computer and use it in GitHub Desktop.
Save tsubaki/6491370 to your computer and use it in GitHub Desktop.
ゲーム内時間の経過時間を求めるタイマー
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