multiple xr toolkit package
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.

ONSPAudioSourceEditor.cs 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /************************************************************************************
  2. Filename : ONSPAudioSourceEditor.cs
  3. Content : This script adds editor functionality to OculusSpatializerUserParams script.
  4. Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  5. Licensed under the Oculus SDK Version 3.5 (the "License");
  6. you may not use the Oculus SDK except in compliance with the License,
  7. which is provided at the time of installation or download, or which
  8. otherwise accompanies this software in either electronic or hard copy form.
  9. You may obtain a copy of the License at
  10. https://developer.oculus.com/licenses/sdk-3.5/
  11. Unless required by applicable law or agreed to in writing, the Oculus SDK
  12. distributed under the License is distributed on an "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. See the License for the specific language governing permissions and
  15. limitations under the License.
  16. ************************************************************************************/
  17. #define CUSTOM_LAYOUT
  18. using UnityEditor;
  19. using UnityEngine;
  20. using System.Collections.Generic;
  21. [CustomEditor(typeof(ONSPAudioSource))]
  22. public class OculusSpatializerUserParamsEditor : Editor
  23. {
  24. // target component
  25. private ONSPAudioSource m_Component;
  26. // OnEnable
  27. void OnEnable()
  28. {
  29. m_Component = (ONSPAudioSource)target;
  30. }
  31. // OnInspectorGUI
  32. public override void OnInspectorGUI()
  33. {
  34. GUI.color = Color.white;
  35. Undo.RecordObject(m_Component, "OculusSpatializerUserParams");
  36. {
  37. EditorGUILayout.HelpBox("Please use a VRC_SpatialAudioSource in the future.", MessageType.Error);
  38. #if CUSTOM_LAYOUT
  39. m_Component.EnableSpatialization = EditorGUILayout.Toggle("Spatialization Enabled", m_Component.EnableSpatialization);
  40. m_Component.EnableRfl = EditorGUILayout.Toggle("Reflections Enabled", m_Component.EnableRfl);
  41. m_Component.Gain = EditorGUILayout.FloatField("Gain", m_Component.Gain);
  42. Separator();
  43. Label ("OCULUS ATTENUATION");
  44. m_Component.UseInvSqr = EditorGUILayout.Toggle("Enabled", m_Component.UseInvSqr);
  45. Label ("");
  46. Label("RANGE (0.0 - 1000000.0 meters)");
  47. m_Component.Near = EditorGUILayout.FloatField("Minimum", m_Component.Near);
  48. m_Component.Far = EditorGUILayout.FloatField("Maximum", m_Component.Far);
  49. Label("");
  50. Label("VOLUMETRIC RADIUS (0.0 - 1000.0 meters)");
  51. m_Component.VolumetricRadius = EditorGUILayout.FloatField("Radius", m_Component.VolumetricRadius);
  52. Separator();
  53. Label("REVERB SEND LEVEL (-60.0 - 20.0 decibels)");
  54. m_Component.ReverbSend = EditorGUILayout.FloatField(" ", m_Component.ReverbSend);
  55. Separator();
  56. #else
  57. DrawDefaultInspector ();
  58. #endif
  59. }
  60. if (GUI.changed)
  61. {
  62. EditorUtility.SetDirty(m_Component);
  63. }
  64. }
  65. // Utilities, move out of here (or copy over to other editor script)
  66. // Separator
  67. void Separator()
  68. {
  69. GUI.color = new Color(1, 1, 1, 0.25f);
  70. GUILayout.Box("", "HorizontalSlider", GUILayout.Height(16));
  71. GUI.color = Color.white;
  72. }
  73. // Label
  74. void Label(string label)
  75. {
  76. EditorGUILayout.LabelField (label);
  77. }
  78. }