リプレイボタンを作成してボタンを押すとシーンをリロードするようにしたのですが
リロードしたシーンではリプレイボタンが出てきません
ボタンはスクリプトで出しています
下記がボタンを出すスクリプトです
public class Ball : MonoBehaviour { public static int Balls = 3; public GameObject nextBall; //ボール生成 public GameObject OptionButton; //ボールリリース void OnMouseUp() { isPressd = false; rb.isKinematic = false; StartCoroutine(Release()); Balls--; StartCoroutine(BallsZanki()); BallsZanki(); } IEnumerator BallsZanki() { if (Balls == 0) { //ボタン呼び出し yield return new WaitForSeconds(3f); OptionButton.SetActive(true); } } //ボールリリース IEnumerator Release () { yield return new WaitForSeconds(releaseTime); GetComponent<SpringJoint2D>().enabled = false; this.enabled = false; //ボール生成 yield return new WaitForSeconds(2f); if(nextBall != null) { GetComponent<AudioSource>().Play(); nextBall.SetActive(true); } } }
回答1件
あなたの回答
tips
プレビュー