前提・実現したいこと
Unity でシーン移行を作成しています。ビルドインデックスが「5」のシーンを読み込みたいです。
発生している問題・エラーメッセージ
しかし、シーンを読み込むことが出来ずビルドインデックスを調べてみると-1が読み込まれます。
エラーメッセージ
該当のソースコード
ソースコードusing System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class startbutton : MonoBehaviour { int[] stageclear; int stage = 40; public void Change() { stageclear = new int[stage]; for (int i = 0; i < stage; i++) { stageclear[i] = PlayerPrefs.GetInt("CLEAR_" + i + 1, 0); if (stageclear[i] == 0) { int x = i + 5; Scene current = SceneManager.GetSceneByBuildIndex(x); int n = current.buildIndex; Debug.Log(n); FadeManager.Instance.LoadScene(current.name, 1.0f); break; } } } }
試したこと
ビルドインデックスからシーンを読み込む方法が間違っているのでしょうか。。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/13 02:22 編集
2019/07/13 02:26
2019/07/13 03:04