加載前,請先Build場景
右側的數字就是場景的ID下標
加載場景方法:SceneManager.LoadScene()
如果要重新加載當前場景,請將+1刪除
加載場景(當前激活場景.建造下標+1)
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1)
1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.SceneManagement; 5 6 public class LoadScence : MonoBehaviour 7 { 8 9 void Update() 10 { 11 12 if (Input.GetKeyDown(KeyCode.N)) 13 { 14 SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); 15 } 16 17 } 18 }