SampleSceneSelectionScript.cs 671 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.SceneManagement;
  4. namespace GPUECSAnimationBaker.Samples
  5. {
  6. public class SampleSceneSelectionScript : MonoBehaviour
  7. {
  8. public string sceneName;
  9. public void LoadScene()
  10. {
  11. AsyncOperation async = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
  12. async.allowSceneActivation = true;
  13. }
  14. public void Update()
  15. {
  16. if (string.IsNullOrEmpty(sceneName) && Input.GetKeyDown(KeyCode.Escape))
  17. {
  18. sceneName = "SampleScenesMenu";
  19. LoadScene();
  20. }
  21. }
  22. }
  23. }