예제 #1
0
 private void Update()
 {
     Debug.Log($"被调用前的值为: {sceneData.GetCurrentIndex()}");
     if (currentSceneIndex != sceneData.GetCurrentIndex())
     {
         SceneManager.LoadSceneAsync(sceneData.GetCurrentIndex());
         currentSceneIndex = sceneData.GetCurrentIndex();
     }
 }
예제 #2
0
    private void Start()
    {
        SceneData sceneData = new SceneData();

        sceneData.setValue(SceneManager.GetActiveScene().buildIndex, SceneManager.sceneCountInBuildSettings, SceneManager.GetActiveScene().name);
        currentSceneIndex = sceneData.GetCurrentIndex();
    }