1.UnityEngine.SceneManagement.SceneManager.LoadScene
注:需要引用命名空间
using UnityEngine.SceneManagement;
使用:
SceneManager.LoadScene(0);
说明:重新加载场景函数,载入到索引为0的场景,同时销毁该场景的所有gameObject并重置为场景原来状态。
2.Object.DontDestroyOnLoad(和上个函数有关联)
使用:
DontDestroyOnLoad(gameObject);</