4 namespace HKI.Core.Audio.Editor
9 [CanEditMultipleObjects]
10 [CustomEditor(typeof(SoundClip))]
14 const string clipSPName =
"Clip";
15 const string volumeSPName =
"Volume";
16 const string pitchSPName =
"Pitch";
18 SerializedProperty clipSP = null;
19 SerializedProperty volumeSP = null;
20 SerializedProperty pitchSP = null;
25 clipSP = serializedObject.FindProperty(clipSPName);
26 volumeSP = serializedObject.FindProperty(volumeSPName);
27 pitchSP = serializedObject.FindProperty(pitchSPName);
39 serializedObject.Update();
41 EditorGUILayout.LabelField(
"General Variables", EditorStyles.boldLabel);
43 EditorGUILayout.BeginHorizontal();
44 EditorGUI.BeginChangeCheck();
45 EditorGUILayout.PropertyField(clipSP);
46 if(EditorGUI.EndChangeCheck())
49 GUI.enabled = clipSP.objectReferenceValue != null;
52 if (GUILayout.Button(
"Stop", GUILayout.Width(50.0f)))
57 if (GUILayout.Button(
"Play", GUILayout.Width(50.0f)))
61 EditorGUILayout.EndHorizontal();
63 EditorGUILayout.PropertyField(volumeSP);
64 EditorGUILayout.PropertyField(pitchSP);
65 serializedObject.ApplyModifiedProperties();
static void PlayClip(AudioClip clip)
This class provides the capability to listen into audio clips in the editor.
static bool IsClipPlaying(AudioClip clip)
override void OnInspectorGUI()
Custom inspector for the SoundClip class.
static void StopClipPlaying()