以下のWarningがでた
OnLevelWasLoaded was found on GameManager
This message has been deprecated and will be removed in a later version of Unity.
Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
This message has been deprecated and will be removed in a later version of Unity.
Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
OnLevelWasLoadedがUnity ver.2017.2では非推奨になっているみたい。
以下のように書き換えました。
Before
void OnLevelWasLoaded(int index) { Debug.log("この処理がしたい!"); }
After
using UnityEngine.SceneManagement; void Start () { SceneManager.sceneLoaded += hoge; } private void hoge (Scene scene, LoadSceneMode sceneMode){ Debug.Log("この処理がしたい!"); }
参考にしたサイト
OnLevelWasLoadedが非推奨になったからSceneManager.sceneLoadedで置き換えてみる【Unity】