MainSceneSample.cs 1020 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using UnityEngine;
  2. using UnityEngine.SceneManagement;
  3. using Rokid.UXR.Module;
  4. //using Google.XR.Cardboard;
  5. using Rokid.UXR.Native;
  6. namespace Rokid.UXR.Demo
  7. {
  8. public class MainSceneSample : MonoBehaviour
  9. {
  10. private bool loadUI;
  11. [SerializeField]
  12. private GameObject ui;
  13. void Start()
  14. {
  15. if (Application.platform == RuntimePlatform.Android)
  16. {
  17. Api.UpdateScreenParams();
  18. }
  19. #if UNITY_EDITOR
  20. ui.gameObject.SetActive(true);
  21. #endif
  22. }
  23. private void OnDestroy()
  24. {
  25. }
  26. public void LoadScene(string sceneName)
  27. {
  28. SceneManager.LoadSceneAsync(sceneName);
  29. }
  30. private void Update()
  31. {
  32. #if !UNITY_EDITOR
  33. if (!loadUI && NativeInterface.NativeAPI.GetHeadTrackingStatus() == HeadTrackingStatus.Tracking)
  34. {
  35. loadUI = true;
  36. ui.gameObject.SetActive(true);
  37. }
  38. #endif
  39. }
  40. }
  41. }