blob: a6466c927d75c838e6fb05e7a4b424c81d2501bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#if VRC_SDK_VRCSDK3
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace VRC.SDK3.Editor
{
[CustomEditor(typeof(VRC.SDK3.Avatars.Components.VRCSpatialAudioSource))]
public class VRCAvatarSpatialAudioSourceEditor3 : UnityEditor.Editor
{
private bool showAdvancedOptions = false;
private SerializedProperty gainProperty;
private SerializedProperty nearProperty;
private SerializedProperty farProperty;
private SerializedProperty volRadiusProperty;
private SerializedProperty enableSpatialProperty;
private SerializedProperty useCurveProperty;
public override void OnInspectorGUI()
{
gainProperty = serializedObject.FindProperty("Gain");
nearProperty = serializedObject.FindProperty("Near");
farProperty = serializedObject.FindProperty("Far");
volRadiusProperty = serializedObject.FindProperty("VolumetricRadius");
enableSpatialProperty = serializedObject.FindProperty("EnableSpatialization");
useCurveProperty = serializedObject.FindProperty("UseAudioSourceVolumeCurve");
serializedObject.Update();
VRC.SDKBase.VRC_SpatialAudioSource target = serializedObject.targetObject as VRC.SDKBase.VRC_SpatialAudioSource;
AudioSource source = target.GetComponent<AudioSource>();
EditorGUILayout.BeginVertical();
EditorGUILayout.PropertyField(gainProperty, new GUIContent("Gain"));
EditorGUILayout.PropertyField(farProperty, new GUIContent("Far"));
showAdvancedOptions = EditorGUILayout.Foldout(showAdvancedOptions, "Advanced Options");
bool enableSp = enableSpatialProperty.boolValue;
if (showAdvancedOptions)
{
EditorGUILayout.PropertyField(nearProperty, new GUIContent("Near"));
EditorGUILayout.PropertyField(volRadiusProperty, new GUIContent("Volumetric Radius"));
EditorGUILayout.PropertyField(enableSpatialProperty, new GUIContent("Enable Spatialization"));
if (enableSp)
EditorGUILayout.PropertyField(useCurveProperty, new GUIContent("Use AudioSource Volume Curve"));
}
EditorGUILayout.EndVertical();
if (source != null)
source.spatialize = enableSp;
serializedObject.ApplyModifiedProperties();
}
}
}
#endif
#endif
|