前提・実現したいこと
5秒ごとにオブジェクトを点滅させたい。
発生している問題・エラーメッセージ
一度オブジェクトが消えた後は時間のカウントが止まってしまい、そのまま消えたままになってしまいます。
該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TextDisplay : MonoBehaviour { public float time=0; public float interval=5f; void FixedUpdate() { time += Time.deltaTime; if(time>= interval) { if (this.gameObject.activeSelf == false) { this.gameObject.SetActive(true); } else { this.gameObject.SetActive(false); } } } }
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
Unity
をタグにつけられた方が良いかと思います
回答1件
あなたの回答
tips
プレビュー