シーンの切り替えをするときに以下のエラーに遭遇した
Scene 'シーン名' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings...
ひとまず言われた通り直す
エラー文に以下ように指示されているので『File』→『Build Settings』で設定を行う
To add a scene to the build settings use the menu File->Build Settings...
『Build Settings』を開く
使うシーンを追加する
Project-Scenesから使うシーンをBuild SettingsのScenes In Buildにドラック&ドロップ
追加したあとの画面
これで動くはずだが、私の環境ではまだ同じエラーが発生していた
LoadScene()の引数(シーン名)のtypoが原因だった
LoadScene
メソッドを使用してシーンの切り替えを行っていたが、引数のシーン名とAssets>Scenesに格納されているシーン名が一致していなかった
public void OnStartButton()
{
SceneManager.LoadScene("シーン名");
}
シーン名を一致させると期待通り動いた