/// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ /// <summary> /// Unity Method | OnInspectorGUI | Overrides the default inspector of the UI Audio Player Script with this custom one. /// </summary> /// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ public override void OnInspectorGUI() { serializedObject.Update(); HeaderDisplay(); if (file.objectReferenceValue == null) { file = serializedObject.FindProperty("audioManagerFile"); } if (!player) { player = (UIAudioPlayer)target; } EditorGUILayout.BeginVertical("Box"); GUILayout.Space(5f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("AMF", EditorStyles.boldLabel, GUILayout.MaxWidth(55f)); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Space(5f); GetClipString(); // Audio Manager File (AMF) field EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(file, new GUIContent("File To Use: ")); EditorGUILayout.EndHorizontal(); GUILayout.Space(5f); EditorGUILayout.EndVertical(); GUILayout.Space(5f); EditorGUILayout.BeginVertical("Box"); GUILayout.Space(5f); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel, GUILayout.MaxWidth(65f)); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); GUILayout.Space(5f); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Volume: ", GUILayout.MaxWidth(55f)); player.volume = EditorGUILayout.FloatField(player.volume); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Pitch: ", GUILayout.MaxWidth(55f)); player.pitch = EditorGUILayout.FloatField(player.pitch); EditorGUILayout.EndHorizontal(); GUILayout.Space(5f); DisplayMixers(); GUILayout.Space(5f); EditorGUILayout.LabelField("Clips To Play:", GUILayout.MaxWidth(100f)); GUILayout.Space(5f); if (player.clipsChosen != null && player.clipsChosen.Count > 0) { for (int i = 0; i < player.clipsChosen.Count; i++) { EditorGUILayout.BeginHorizontal(); player.clipsChosen[i] = EditorGUILayout.Popup(player.clipsChosen[i], player.clipsToPlay.ToArray()); GUI.color = grnCol; if (GUILayout.Button("+", GUILayout.Width(25))) { player.clipsChosen.Add(0); } if (!i.Equals(0)) { GUI.color = Color.red; if (GUILayout.Button("-", GUILayout.Width(25))) { player.clipsChosen.RemoveAt(i); } } else { GUI.color = Color.black; if (GUILayout.Button("", GUILayout.Width(25))) { } } GUI.color = Color.white; EditorGUILayout.EndHorizontal(); } } else { EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add Clip(s)", GUILayout.Width(85))) { player.clipsChosen.Add(0); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } GUILayout.Space(5f); EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
/// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ /// <summary> /// Unity Method | OnEnable | Assigns the script and does any setup needed. /// </summary> /// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ private void OnEnable() { file = serializedObject.FindProperty("audioManagerFile"); player = (UIAudioPlayer)target; }