コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Cannot load scene: Invalid scene name (empty string) and invalid build index -1

概要

Unity 2019.3 で Enter Play Mode を有効にしているプロジェクトで

SceneManager.LoadScene( SceneManager.GetActiveScene().buildIndex );

上記のように現在のシーンを再読み込みしようとしたところ

Cannot load scene: Invalid scene name (empty string) and invalid build index -1

このエラーが発生してシーンの読み込みに失敗した

f:id:baba_s:20200514162236p:plain

Player Settings で「Reload Scene」をオンにしたら解決した