###前提・実現したいこと
Unityでゲームを作成しており、タイマーのカウントダウン機能を作りたいと思っています。
とあるサイトを真似て作ってみたのですが、カウントダウンが止まらず0以降も-1,-2とカウントが進んでいきます。
カウントをストップさせるにはどのような方法がありますか?
また、カウントが0になるとTextで文字が表示されるようなことも可能なのでしょうか?
よろしくお願いいたします。
###該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class timecontroller : MonoBehaviour { public Text Text; public float totalTime; int seconds; // Use this for initialization void Start () { } // Update is called once per frame void Update () { totalTime -= Time.deltaTime; seconds = (int)totalTime; Text.text= seconds.ToString(); } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。