AudioStreamReceiverEditor.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using UnityEditor;
  4. namespace Unity.RenderStreaming.Editor
  5. {
  6. [CustomEditor(typeof(AudioStreamReceiver))]
  7. [CanEditMultipleObjects]
  8. internal class AudioStreamSenderReceiver : UnityEditor.Editor
  9. {
  10. class Styles
  11. {
  12. }
  13. static Styles s_Styles;
  14. SerializedProperty m_codec;
  15. SerializedProperty m_targetAudioSource;
  16. void OnEnable()
  17. {
  18. m_codec = serializedObject.FindProperty("m_Codec");
  19. m_targetAudioSource = serializedObject.FindProperty("m_TargetAudioSource");
  20. }
  21. void OnDisable()
  22. {
  23. }
  24. public override void OnInspectorGUI()
  25. {
  26. if (s_Styles == null)
  27. s_Styles = new Styles();
  28. serializedObject.Update();
  29. bool disableEditMediaSource = Application.isPlaying;
  30. /// todo(kazuki): Make available to change video source parameters in runtime.
  31. using (new EditorGUI.DisabledScope(disableEditMediaSource))
  32. {
  33. EditorGUILayout.PropertyField(m_targetAudioSource);
  34. EditorGUILayout.Space();
  35. EditorGUILayout.PropertyField(m_codec);
  36. }
  37. serializedObject.ApplyModifiedProperties();
  38. }
  39. }
  40. }
  41. #endif