Exemple #1
0
        protected override void DrawQuickReferenceGuide()
        {
            base.DrawQuickReferenceGuide();

            if (!showHowTo)
            {
                return;
            }

            EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This component is meant to be attached to a Particle System." +
                                    " When a particle is created or is destroyed, AudioParticles will play a sound."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("This component should be placed on the same GameObject that holds the Particle System."
                                    , MessageType.None);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Feel free to use multiple different AudioParticles components on the same GameObject so your" +
                                    " Particle System plays sounds on both instantiation and destruction!"
                                    , MessageType.None);

            EditorCompatability.EndSpecialFoldoutGroup();
        }
Exemple #2
0
        protected override void DrawQuickReferenceGuide()
        {
            base.DrawQuickReferenceGuide();

            if (!showHowTo)
            {
                return;
            }

            EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("This component is meant to be attached to a physics-enabled object." +
                                    " When something intersects with that physics-enabled object, this component will play a sound." +
                                    " You can choose to change the trigger event that plays the sound by using the Trigger Event drop-down." +
                                    " You can select a sound to play using the drop-down at the top of the component."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("This component should be placed on the same GameObject that holds the physics object's Rigidbody"
                                    , MessageType.None);
            EditorGUILayout.HelpBox("AudioTriggerFeedback responds to both 2D and 3D trigger events."
                                    , MessageType.None);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Sometimes you want your object to produce different sounds when intersecting different things" +
                                    " so you can specify different collision layers for this component to react to under" +
                                    " the Trigger Settings field. "
                                    , MessageType.None);
            EditorGUILayout.HelpBox("Feel free to use multiple different AudioTriggerFeedback components on the same GameObject!"
                                    , MessageType.None);

            EditorCompatability.EndSpecialFoldoutGroup();
        }
Exemple #3
0
        protected override void DrawQuickReferenceGuide()
        {
            base.DrawQuickReferenceGuide();

            if (!showHowTo)
            {
                return;
            }

            EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox(
                "This component allows you to easily play sounds anywhere in the scene."
                , MessageType.None);
            EditorGUILayout.HelpBox(
                "To get started, choose your sound to play from the drop-down at the top. " +
                "Make sure you've generated your Audio Libraries in your Audio Manager. "
                , MessageType.None);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox(
                "Alternatively, you can specify to use your own AudioClip by filling in the AudioClip. " +
                "You can then fill out the Custom AudioClip settings so the AudioPlayer plays your sound to your liking."
                , MessageType.None);
            EditorGUILayout.HelpBox(
                "AudioPlayer includes a public function Play() that lets you play the sound in AudioPlayer on your own. " +
                "AudioPlayer's Play() function also returns the AudioSource to let you further modify the audio being played."
                , MessageType.None);

            EditorCompatability.EndSpecialFoldoutGroup();
        }
        protected override void DrawQuickReferenceGuide()
        {
            base.DrawQuickReferenceGuide();

            if (!showHowTo)
            {
                return;
            }

            EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("Audio Music Zones are like AudioPlayerMusic components in that they playback music in the scene. " +
                                    "However, music is only played when the scene's AudioListener enters a \"Music Zone.\""
                                    , MessageType.None);
            EditorGUILayout.HelpBox("\"Music Zones\" are defined by a position, a min distance, and a max distance. You can " +
                                    "create a new \"Music Zone\" by clicking either \"Add New Zone at World Center\" or \"Add New Zone at This Position\"."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("The max distance indicates the distance the AudioListener has to be from the Zone's position to hear the music " +
                                    "at minimal volume."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("The min distance indicates the distance the AudioListener has to be from the Zone's position to hear the music " +
                                    "at maximum volume."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("If the AudioListener is in-between the min and max distances, the volume of the music will be " +
                                    " played relative to the player's middle distance."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("There should only be one Audio Music Zone for each music track in the scene."
                                    , MessageType.None);
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("You can assign multiple zone positions to this one component to cover a large range."
                                    , MessageType.None);
            EditorGUILayout.HelpBox("Click the \"Hide Transform Tool\" option to hide this GameObject's transform tool and " +
                                    "make it easier to manipulate the positions of your Music Zones."
                                    , MessageType.None);
            EditorStyles.helpBox.fontSize = 10;
            EditorCompatability.EndSpecialFoldoutGroup();
        }
        public void DrawPositionsEditor()
        {
            bool hideTool = EditorGUILayout.Toggle("Hide Transform Tool", hideTransformTool);

            if (hideTool != hideTransformTool)
            {
                hideTransformTool = hideTool;
                Tools.hidden      = hideTransformTool;
                if (SceneView.sceneViews.Count > 0)
                {
                    SceneView.lastActiveSceneView.Repaint();
                }
            }

            List <int> markedForDeletion = new List <int>();
            GUIContent blontent;

            bool previousFoldout = positionsFoldout;

            positionsFoldout = EditorCompatability.SpecialFoldouts(positionsFoldout, "Music Zone");
            if (previousFoldout != positionsFoldout) // Toggle handles in scene view
            {
                if (SceneView.sceneViews.Count > 0)
                {
                    SceneView.lastActiveSceneView.Repaint();
                }
            }
            if (positionsFoldout)
            {
                for (int i = 0; i < positionsProperty.arraySize; i++)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    SerializedProperty position = positionsProperty.GetArrayElementAtIndex(i);
                    if (foldouts.Count < i + 1)
                    {
                        foldouts.Add(false);
                    }
                    string arrow = (foldouts[i]) ? "▼" : "▶";
                    EditorGUILayout.BeginHorizontal();
                    foldouts[i] = EditorGUILayout.Foldout(foldouts[i], new GUIContent("    " + arrow + " Zone " + i), true, EditorStyles.boldLabel);
                    if (GUILayout.Button(new GUIContent("x", "Remove this transform"), new GUILayoutOption[] { GUILayout.MaxWidth(20) }))
                    {
                        markedForDeletion.Add(i);
                    }
                    EditorGUILayout.EndHorizontal();
                    if (foldouts[i])
                    {
                        position.vector3Value = EditorGUILayout.Vector3Field(new GUIContent("Position"), position.vector3Value);

                        SerializedProperty minDistance = minDistanceProperty.GetArrayElementAtIndex(i);
                        SerializedProperty maxDistance = maxDistanceProperty.GetArrayElementAtIndex(i);

                        blontent = new GUIContent("Min Distance", "The minimum distance the listener can be at to hear the music " +
                                                  "in this music zone. The music will be at it's loudest when the listener is equal to or below this distance to this zone.");
                        minDistance.floatValue = EditorGUILayout.FloatField(blontent, minDistance.floatValue);
                        if (minDistance.floatValue > maxDistance.floatValue)
                        {
                            minDistance.floatValue = maxDistance.floatValue;
                        }
                        else if (minDistance.floatValue < 0)
                        {
                            minDistance.floatValue = 0;
                        }

                        blontent = new GUIContent("Max Distance", "The maximum distance the listener can be at to hear the music " +
                                                  "in this music zone. Volume of the music will increase as listener approaches the minimum distance.");
                        maxDistance.floatValue = EditorGUILayout.FloatField(blontent, maxDistance.floatValue);
                        if (maxDistance.floatValue < minDistance.floatValue)
                        {
                            maxDistance.floatValue = minDistance.floatValue;
                        }
                        else if (maxDistance.floatValue < 0)
                        {
                            maxDistance.floatValue = 0;
                        }
                    }
                    EditorGUILayout.EndVertical();
                }

                foreach (int item in markedForDeletion)
                {
                    foldouts.RemoveAt(item);
                    positionsProperty.DeleteArrayElementAtIndex(item);
                }
            }
            EditorCompatability.EndSpecialFoldoutGroup();

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Add New Zone At World Center"))
            {
                int index = positionsProperty.arraySize;
                positionsProperty.InsertArrayElementAtIndex(index);
                positionsProperty.GetArrayElementAtIndex(index).vector3Value = Vector3.zero;

                maxDistanceProperty.InsertArrayElementAtIndex(index);
                maxDistanceProperty.GetArrayElementAtIndex(index).floatValue = 15;

                minDistanceProperty.InsertArrayElementAtIndex(index);
                minDistanceProperty.GetArrayElementAtIndex(index).floatValue = 10;

                positionsFoldout = true;
                foldouts.Add(true);
            }

            if (GUILayout.Button("Add New Zone At This Position"))
            {
                int index = positionsProperty.arraySize;
                positionsProperty.InsertArrayElementAtIndex(index);
                positionsProperty.GetArrayElementAtIndex(index).vector3Value = myScript.transform.position;

                maxDistanceProperty.InsertArrayElementAtIndex(index);
                maxDistanceProperty.GetArrayElementAtIndex(index).floatValue = 15;

                minDistanceProperty.InsertArrayElementAtIndex(index);
                minDistanceProperty.GetArrayElementAtIndex(index).floatValue = 10;

                positionsFoldout = true;
                foldouts.Add(true);
            }
            EditorGUILayout.EndHorizontal();
        }
Exemple #6
0
        public override void OnInspectorGUI()
        {
            if (myScript == null)
            {
                return;
            }

            serializedObject.Update();

            if (!AudioManager.instance)
            {
                EditorGUILayout.HelpBox("Could not find Audio Manager in the scene! This component needs AudioManager " +
                                        "in order to function!", MessageType.Error);
            }
            else
            {
                if (enumType == null)
                {
                    EditorGUILayout.HelpBox("Could not find Audio File info! Try regenerating Audio Files in AudioManager!", MessageType.Error);
                }
            }

            EditorGUILayout.LabelField("Choose a Sound to Play", EditorStyles.boldLabel);

            GUIContent soundDesc = new GUIContent("Sound", "Sound that will be played");

            int selected = options.IndexOf(sound.stringValue);

            if (selected == -1)
            {
                selected = 0;
            }
            if (options.Count > 0)
            {
                sound.stringValue = options[EditorGUILayout.Popup(soundDesc, selected, options.ToArray())];
            }
            else
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.Popup(soundDesc, selected, new string[] { "<None>" });
                }
            }

            EditorGUILayout.Space();

            GUIContent lontent = new GUIContent("Audio Player Settings", "Modify settings specific to the Audio Player");

            EditorGUILayout.LabelField(lontent, EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(loopSound);
            EditorGUILayout.PropertyField(onStart);
            EditorGUILayout.PropertyField(onEnable);
            EditorGUILayout.PropertyField(onDisable);
            EditorGUILayout.PropertyField(onDestroy);

            if (serializedObject.hasModifiedProperties)
            {
                serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.Space();

            #region Quick Reference Guide
            showHowTo = EditorCompatability.SpecialFoldouts(showHowTo, "Quick Reference Guide");
            if (showHowTo)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(
                    "This component allows you to easily play sounds anywhere in the scene."
                    , MessageType.None);
                EditorGUILayout.HelpBox(
                    "To get started, choose your sound to play from the drop-down at the top. " +
                    "Make sure you've generated your Audio Libraries in your Audio Manager. "
                    , MessageType.None);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(
                    "Alternatively, you can specify to use your own AudioClip by filling in the AudioClip. " +
                    "You can then fill out the Custom AudioClip settings so the AudioPlayer plays your sound to your liking."
                    , MessageType.None);
                EditorGUILayout.HelpBox(
                    "AudioPlayer includes a public function Play() that lets you play the sound in AudioPlayer on your own. " +
                    "AudioPlayer's Play() function also returns the AudioSource to let you further modify the audio being played."
                    , MessageType.None);
            }
            EditorCompatability.EndSpecialFoldoutGroup();
            #endregion
        }
        public override void OnInspectorGUI()
        {
            if (myScript == null)
            {
                return;
            }

            serializedObject.Update();

            if (!AudioManager.instance)
            {
                EditorGUILayout.HelpBox("Could not find Audio Manager in the scene! This component needs AudioManager " +
                                        "in order to function!", MessageType.Error);
            }
            else
            {
                if (enumType == null)
                {
                    EditorGUILayout.HelpBox("Could not find Audio File info! Try regenerating Audio Files in AudioManager!", MessageType.Error);
                }
            }

            EditorGUILayout.LabelField("Specify Music to Play", EditorStyles.boldLabel);

            if (isSharing)
            {
                EditorGUILayout.HelpBox("Another Audio Music Zone exists in this scene that plays the same music! You can only " +
                                        "have one Audio Music Zone that plays a specific piece of music.", MessageType.Error);
            }

            GUIContent musicDesc = new GUIContent("Music", "Music that will be played");

            string music = musicProperty.stringValue;

            int selected = options.IndexOf(music);

            if (selected == -1)
            {
                selected = 0;
            }
            string newValue = "";

            if (options.Count > 0)
            {
                newValue = options[EditorGUILayout.Popup(musicDesc, selected, options.ToArray())];
            }
            else
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.Popup(musicDesc, selected, new string[] { "<None>" });
                }
            }

            if (musicProperty.stringValue != newValue)
            {
                CheckIfSharing();
                musicProperty.stringValue = newValue;
            }

            List <string> excludedProperties = new List <string>
            {
                "m_Script", "musicFile", "playOnStart", "playOnEnable", "spatializeSound", "loopMode",
                "stopOnDisable", "stopOnDestroy", "keepPlaybackPosition", "restartOnReplay", "musicFadeInTime",
                "musicFadeOutTime", "transitionMode", "positions", "maxDistance", "minDistance"
            };

            DrawPropertiesExcluding(serializedObject, excludedProperties.ToArray());

            DrawPositionsEditor();

            if (serializedObject.hasModifiedProperties)
            {
                serializedObject.ApplyModifiedProperties();
            }

            #region Quick Reference Guide
            showHowTo = EditorCompatability.SpecialFoldouts(showHowTo, "Quick Reference Guide");
            if (showHowTo)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("Audio Music Zones are like AudioPlayerMusic components in that they playback music in the scene. " +
                                        "However, music is only played when the scene's AudioListener enters a \"Music Zone.\""
                                        , MessageType.None);
                EditorGUILayout.HelpBox("\"Music Zones\" are defined by a position, a min distance, and a max distance. You can " +
                                        "create a new \"Music Zone\" by clicking either \"Add New Zone at World Center\" or \"Add New Zone at This Position\"."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("The max distance indicates the distance the AudioListener has to be from the Zone's position to hear the music " +
                                        "at minimal volume."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("The min distance indicates the distance the AudioListener has to be from the Zone's position to hear the music " +
                                        "at maximum volume."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("If the AudioListener is in-between the min and max distances, the volume of the music will be " +
                                        " played relative to the player's middle distance."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("There should only be one Audio Music Zone for each music track in the scene."
                                        , MessageType.None);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("You can assign multiple zone positions to this one component to cover a large range."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("Click the \"Hide Transform Tool\" option to hide this GameObject's transform tool and " +
                                        "make it easier to manipulate the positions of your Music Zones."
                                        , MessageType.None);
                EditorStyles.helpBox.fontSize = 10;
            }
            EditorCompatability.EndSpecialFoldoutGroup();
            #endregion
        }
        public override void OnInspectorGUI()
        {
            DrawPropertiesExcluding(serializedObject, new[] { "m_Script" });

            #region Quick Reference Guide
            showHowTo = EditorCompatability.SpecialFoldouts(showHowTo, "Quick Reference Guide");
            if (showHowTo)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(
                    "This component is specifically meant to be used as a companion component to various Event handling components."
                    , MessageType.None);
                EditorGUILayout.HelpBox(
                    "This includes things like UnityEvents and Unity Animation Events, among other things."
                    , MessageType.None);
                EditorGUILayout.HelpBox(
                    "This component contains some helpful methods meant to be called by these Event systems."
                    , MessageType.None);

                if (GUILayout.Button("Guide on using JSAM with Mecanim", new GUILayoutOption[] { GUILayout.MinWidth(100) }))
                {
                    Application.OpenURL("https://github.com/jackyyang09/Simple-Unity-Audio-Manager/wiki/8.-Using-JSAM-with-Mecanim");
                }

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("public void PlayAudioPlayer (AudioPlayer player)");
                EditorGUILayout.HelpBox("Pass the AudioPlayer to play it's contents", MessageType.None);

                EditorGUILayout.LabelField("public void PlaySoundByEnum (string enumName)");
                EditorGUILayout.HelpBox("Takes the Enum name of the Audio File to be played and plays it according to the File's settings", MessageType.None);

                EditorGUILayout.LabelField("public void PlayLoopingSoundByEnum (string enumName)");
                EditorGUILayout.HelpBox("Does the same as PlaySoundByEnum but loops the sound instead", MessageType.None);

                EditorGUILayout.LabelField("public void StopLoopingSoundByEnum (string enumName)");
                EditorGUILayout.HelpBox("Stops an existing looping sound whose Audio File name matches the one specified", MessageType.None);

                EditorGUILayout.LabelField("public void SetMasterVolume (float newVolume)");
                EditorGUILayout.HelpBox("Changes the volume level of the Master channel to the specified value from 0 to 1", MessageType.None);

                EditorGUILayout.LabelField("public void SetMusicVolume (float newVolume)");
                EditorGUILayout.HelpBox("Changes the volume level of the Music channel to the specified value from 0 to 1", MessageType.None);

                EditorGUILayout.LabelField("public void SetSoundVolume (float newVolume)");
                EditorGUILayout.HelpBox("Changes the volume level of the Sound channel to the specified value from 0 to 1", MessageType.None);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(
                    "To learn more about how to use Animation Events as well as Unity's Animation System, do check out " +
                    "their online Manual."
                    , MessageType.None);
                if (GUILayout.Button("Using Unity Animation Events", new GUILayoutOption[] { GUILayout.MinWidth(100) }))
                {
                    Application.OpenURL("https://docs.unity3d.com/Manual/script-AnimationWindowEvent.html");
                }
                if (GUILayout.Button("Animation Events with Imported Animations", new GUILayoutOption[] { GUILayout.MinWidth(100) }))
                {
                    Application.OpenURL("https://docs.unity3d.com/Manual/AnimationEventsOnImportedClips.html");
                }
            }
            EditorCompatability.EndSpecialFoldoutGroup();
            #endregion
        }
Exemple #9
0
        private void OnGUI()
        {
            if (selectedMusic || selectedClip || selectedSound)
            {
                DrawPlaybackTool(selectedClip, selectedSound, selectedMusic);
                EditorGUILayout.LabelField("Now Playing - " + helperSource.clip.name);

                if (!resized)
                {
                    if (lastWindowSize != Window.position.size)
                    {
                        lastWindowSize = Window.position.size;
                        resized        = true;
                    }
                }
                if (selectedSound)
                {
                    if (selectedSound.useLibrary && selectedSound.GetFileCount() > 1)
                    {
                        showLibraryView = EditorCompatability.SpecialFoldouts(showLibraryView, "Show Audio File Object Library");
                        if (showLibraryView)
                        {
                            foreach (AudioClip sound in selectedSound.GetFiles())
                            {
                                Color colorbackup = GUI.backgroundColor;
                                //EditorGUILayout.BeginHorizontal();
                                if (helperSource.clip == sound)
                                {
                                    GUI.backgroundColor = buttonPressedColor;
                                }
                                GUIContent bContent = new GUIContent(sound.name, "Click to change AudioClip being played back to " + sound.name);
                                if (GUILayout.Button(bContent))
                                {
                                    // Play the sound
                                    selectedClip      = sound;
                                    helperSource.clip = selectedClip;
                                    AudioFileObjectEditor.instance.StartFading(selectedSound, helperSource.clip);
                                    clipPlaying = true;
                                }
                                //EditorGUILayout.EndHorizontal();
                                GUI.backgroundColor = colorbackup;
                            }
                        }
                        EditorCompatability.EndSpecialFoldoutGroup();
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox(
                    "No JSAM Audio File selected, select one in the Project window to preview it!"
                    , MessageType.Info);
                EditorGUILayout.Space();
            }

            #region Quick Reference Guide
            showHowTo = EditorCompatability.SpecialFoldouts(showHowTo, "Quick Reference Guide (Expand window before opening)");
            if (showHowTo)
            {
                Window.minSize      = new Vector2(Window.minSize.x, Mathf.Clamp(Window.minSize.x, playbackPreviewClamped, 4000));
                guideScrollProgress = EditorGUILayout.BeginScrollView(guideScrollProgress, new GUILayoutOption[] { GUILayout.ExpandHeight(true) });

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(
                    "This EditorWindow serves as a high-fidelity alternative to the small playback preview in the inspector window used when inspecting Audio File Objects."
                    , MessageType.None);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox(
                    "The active playing clip can be changed by selecting different assets in the Project window."
                    , MessageType.None);
                EditorGUILayout.HelpBox(
                    "You can open the JSAM Playback Tool by double-clicking on Audio File assets in the Project window."
                    , MessageType.None);
                EditorGUILayout.HelpBox(
                    "The JSAM Playback Tool can also play standard AudioClips!"
                    , MessageType.None);

                EditorGUILayout.EndScrollView();
            }
            EditorCompatability.EndSpecialFoldoutGroup();
            #endregion
        }
Exemple #10
0
        public override void OnInspectorGUI()
        {
            if (myScript == null)
            {
                return;
            }

            serializedObject.Update();

            if (!AudioManager.instance)
            {
                EditorGUILayout.HelpBox("Could not find Audio Manager in the scene! This component needs AudioManager " +
                                        "in order to function!", MessageType.Error);
            }
            else
            {
                if (enumType == null)
                {
                    EditorGUILayout.HelpBox("Could not find Audio File info! Try regenerating Audio Files in AudioManager!", MessageType.Error);
                }
            }

            EditorGUILayout.LabelField("Choose a Sound to Play", EditorStyles.boldLabel);

            GUIContent soundDesc = new GUIContent("Sound", "Sound that will be played on collision");

            int selected = options.IndexOf(sound.stringValue);

            if (selected == -1)
            {
                selected = 0;
            }
            if (options.Count > 0)
            {
                sound.stringValue = options[EditorGUILayout.Popup(soundDesc, selected, options.ToArray())];
            }
            else
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.Popup(soundDesc, selected, new string[] { "<None>" });
                }
            }

            EditorGUILayout.PropertyField(collidesWithProperty);
            EditorGUILayout.PropertyField(triggerEventProperty);

            if (serializedObject.hasModifiedProperties)
            {
                serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.Space();

            showHowTo = EditorCompatability.SpecialFoldouts(showHowTo, "Quick Reference Guide");
            if (showHowTo)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("This component is meant to be attached to a physics-enabled object." +
                                        " When something collides with that physics-enabled object, this component will play a sound." +
                                        " You can choose to change the collision event that plays the sound by using the Collision Event drop-down." +
                                        " You can select a sound to play using the drop-down at the top of the component."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("This component should be placed on the same GameObject that holds the physics object's Rigidbody"
                                        , MessageType.None);
                EditorGUILayout.HelpBox("AudioCollisionFeedback responds to both 2D and 3D collision events."
                                        , MessageType.None);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("Sometimes you want your object to produce different sounds when colliding with different things" +
                                        " (ie. walking on different surfaces) so you can specify different collision layers for this component to react to under" +
                                        " the Collision Settings field. "
                                        , MessageType.None);
                EditorGUILayout.HelpBox("Feel free to use multiple different AudioCollisionFeedback components on the same GameObject!"
                                        , MessageType.None);
            }
            EditorCompatability.EndSpecialFoldoutGroup();
        }
        public override void OnInspectorGUI()
        {
            if (myScript == null)
            {
                return;
            }

            serializedObject.Update();

            if (!AudioManager.instance)
            {
                EditorGUILayout.HelpBox("Could not find Audio Manager in the scene! This component needs AudioManager " +
                                        "in order to function!", MessageType.Error);
            }
            else
            {
                if (enumType == null)
                {
                    EditorGUILayout.HelpBox("Could not find Audio File info! Try regenerating Audio Files in AudioManager!", MessageType.Error);
                }
            }

            EditorGUILayout.LabelField("Choose a Sound to Play", EditorStyles.boldLabel);

            GUIContent soundDesc = new GUIContent("Sound", "Sound that will be played when particles spawn/die");

            int selected = options.IndexOf(sound.stringValue);

            if (selected == -1)
            {
                selected = 0;
            }
            if (options.Count > 0)
            {
                sound.stringValue = options[EditorGUILayout.Popup(soundDesc, selected, options.ToArray())];
            }
            else
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.Popup(soundDesc, selected, new string[] { "<None>" });
                }
            }

            EditorGUILayout.PropertyField(playSoundOn);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.Space();

            showHowTo = EditorCompatability.SpecialFoldouts(showHowTo, "Quick Reference Guide");
            if (showHowTo)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Overview", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("This component is meant to be attached to a Particle System." +
                                        " When a particle is created or is destroyed, AudioParticles will play a sound."
                                        , MessageType.None);
                EditorGUILayout.HelpBox("This component should be placed on the same GameObject that holds the Particle System."
                                        , MessageType.None);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Tips", EditorStyles.boldLabel);
                EditorGUILayout.HelpBox("Feel free to use multiple different AudioParticles components on the same GameObject so your" +
                                        " Particle System plays sounds on both instantiation and destruction!"
                                        , MessageType.None);
            }
            EditorCompatability.EndSpecialFoldoutGroup();
        }