You have to sceneLoaded
as an event.
Register sceneLoaded
event in the Start()
or Awake()
function.
SceneManager.sceneLoaded += this.OnLoadCallback;
The OnLoadCallback
function will then be called when scene is loaded.
The OnLoadCallback
function signature:
void OnLoadCallback(Scene scene, LoadSceneMode sceneMode)
{
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…