SteamVR_Preferences.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //======= Copyright (c) Valve Corporation, All rights reserved. ===============
  2. //
  3. // Purpose: Preferences pane for how SteamVR plugin behaves.
  4. //
  5. //=============================================================================
  6. using UnityEngine;
  7. using UnityEditor;
  8. public class SteamVR_Preferences
  9. {
  10. /// <summary>
  11. /// Should SteamVR automatically enable VR when opening Unity or pressing play.
  12. /// </summary>
  13. public static bool AutoEnableVR
  14. {
  15. get
  16. {
  17. return EditorPrefs.GetBool("SteamVR_AutoEnableVR", true);
  18. }
  19. set
  20. {
  21. EditorPrefs.SetBool("SteamVR_AutoEnableVR", value);
  22. }
  23. }
  24. [PreferenceItem("SteamVR")]
  25. static void PreferencesGUI()
  26. {
  27. EditorGUILayout.BeginVertical();
  28. EditorGUILayout.Space();
  29. // Automatically Enable VR
  30. {
  31. string title = "Automatically Enable VR";
  32. string tooltip = "Should SteamVR automatically enable VR on launch and play?";
  33. AutoEnableVR = EditorGUILayout.Toggle(new GUIContent(title, tooltip), AutoEnableVR);
  34. string helpMessage = "To enable VR manually:\n";
  35. helpMessage += "- go to Edit -> Project Settings -> Player,\n";
  36. helpMessage += "- tick 'Virtual Reality Supported',\n";
  37. helpMessage += "- make sure OpenVR is in the 'Virtual Reality SDKs' list.";
  38. EditorGUILayout.HelpBox(helpMessage, MessageType.Info);
  39. }
  40. EditorGUILayout.EndVertical();
  41. }
  42. }