MediaPlayerEditor_Global.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using UnityEngine;
  2. using UnityEditor;
  3. //-----------------------------------------------------------------------------
  4. // Copyright 2015-2021 RenderHeads Ltd. All rights reserved.
  5. //-----------------------------------------------------------------------------
  6. namespace RenderHeads.Media.AVProVideo.Editor
  7. {
  8. /// <summary>
  9. /// Editor for the MediaPlayer component
  10. /// </summary>
  11. public partial class MediaPlayerEditor : UnityEditor.Editor
  12. {
  13. private void OnInspectorGUI_GlobalSettings()
  14. {
  15. EditorGUI.BeginDisabledGroup(Application.isPlaying);
  16. EditorGUILayout.LabelField("Target Platform", EditorUserBuildSettings.selectedBuildTargetGroup.ToString());
  17. if (EditorUserBuildSettings.selectedBuildTargetGroup != BuildTargetGroup.Standalone)
  18. {
  19. EditorHelper.IMGUI.NoticeBox(MessageType.Warning, "These global options only affect the current target platform so will not apply in-editor unless you change your Build Target and reapply them.");
  20. }
  21. EditorGUILayout.BeginVertical(GUI.skin.box);
  22. GUILayout.Label("Video Capture", EditorStyles.boldLabel);
  23. // TimeScale
  24. {
  25. const string TimeScaleDefine = "AVPROVIDEO_BETA_SUPPORT_TIMESCALE";
  26. if (EditorHelper.IMGUI.ToggleScriptDefine("TimeScale Support", TimeScaleDefine))
  27. {
  28. EditorHelper.IMGUI.NoticeBox(MessageType.Warning, "This will affect performance if you change Time.timeScale or Time.captureFramerate. This feature is useful for supporting video capture system that adjust time scale during capturing.");
  29. }
  30. }
  31. EditorGUILayout.EndVertical();
  32. EditorGUILayout.BeginVertical(GUI.skin.box);
  33. GUILayout.Label("Other", EditorStyles.boldLabel);
  34. // Disable Logging
  35. {
  36. const string DisableLogging = "AVPROVIDEO_DISABLE_LOGGING";
  37. EditorHelper.IMGUI.ToggleScriptDefine("Disable Logging", DisableLogging);
  38. }
  39. // Show Ultra Options
  40. {
  41. const string ShowUltraOptions = "AVPROVIDEO_SHOW_ULTRA_OPTIONS";
  42. EditorHelper.IMGUI.ToggleScriptDefine("Show Ultra Options", ShowUltraOptions);
  43. }
  44. _allowDeveloperMode = EditorGUILayout.Toggle(new GUIContent("Developer Mode", "Enables some additional information useful for debugging"), _allowDeveloperMode);
  45. if (_allowDeveloperMode)
  46. {
  47. EditorGUI.indentLevel++;
  48. EditorGUILayout.BeginVertical(GUI.skin.box);
  49. GUILayout.Label("BETA / Experimental", EditorStyles.boldLabel);
  50. // Disable Debug GUI
  51. {
  52. const string SupportBufferedDisplayDefine = "AVPROVIDEO_SUPPORT_BUFFERED_DISPLAY";
  53. if (!EditorHelper.IMGUI.ToggleScriptDefine("Support Buffered Display", SupportBufferedDisplayDefine))
  54. {
  55. EditorHelper.IMGUI.NoticeBox(MessageType.Info, "The Debug GUI can be disabled globally for builds to help reduce garbage generation each frame.");
  56. }
  57. }
  58. EditorGUILayout.EndVertical();
  59. EditorGUI.indentLevel--;
  60. }
  61. EditorGUILayout.EndVertical();
  62. EditorGUI.EndDisabledGroup();
  63. }
  64. }
  65. }