Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active December 22, 2015 20:19
Show Gist options
  • Save tsubaki/6525802 to your computer and use it in GitHub Desktop.
Save tsubaki/6525802 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 ("push")) {
startTime = Time.realtimeSinceStartup;
}
if (startTime != 0) {
second = (Time.realtimeSinceStartup - startTime);
}
GUILayout.Label (second.ToString ());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment