Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

  1. using System.Collections;
  2. using System.IO;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. // Create menu of all scenes included in the build.
  7. public class StartMenu : MonoBehaviour
  8. {
  9. public OVROverlay overlay;
  10. public OVROverlay text;
  11. public OVRCameraRig vrRig;
  12. void Start()
  13. {
  14. DebugUIBuilder.instance.AddLabel("Select Sample Scene");
  15. int n = UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings;
  16. for (int i = 0; i < n; ++i)
  17. {
  18. string path = UnityEngine.SceneManagement.SceneUtility.GetScenePathByBuildIndex(i);
  19. var sceneIndex = i;
  20. DebugUIBuilder.instance.AddButton(Path.GetFileNameWithoutExtension(path), () => LoadScene(sceneIndex));
  21. }
  22. DebugUIBuilder.instance.Show();
  23. }
  24. void LoadScene(int idx)
  25. {
  26. DebugUIBuilder.instance.Hide();
  27. Debug.Log("Load scene: " + idx);
  28. UnityEngine.SceneManagement.SceneManager.LoadScene(idx);
  29. }
  30. }