Like EditorApplication.Beep(), but with configurable sounds
Install the package with OpenUPM
$ openupm add com.jd.editoraudioutils
or download the Latest Unity Packages
- Set your own notification sounds through Project Settings -> EditorAudioUtils
- Play custom notification sounds through a simple API
- Play, Pause, Resume and stop any AudioClip in the editor without the need of an AudioSource
- Handle different internal Unity API from Unity 2019 onwards
- Disable or overwrite notification sounds through EditorPrefs. This way each user can decide if and what notification settings they want, while the project itself contains the default settings.
Play a predefined notification sound:
// This is the simplest call to play a notification
EditorAudioUtility.PlayNotificationSound(EditorNotificationSound type);
// Delayed might be necessary if the sound should be played after a resource intense task
EditorAudioUtility.PlayNotificationSoundDelayed(EditorNotificationSound type, float secondsDelay);
Access other internal AudioUtil methods (EditorAudioUtility):
// Play clip
EditorAudioUtility.PlayPreviewClip(AudioClip audioClip);
EditorAudioUtility.PlayPreviewClip(AudioClip audioClip, int startSample, bool loop);
// For Unity 2020+ the input will be ignored and applied to all clips
// You can use EditorAudioUtility.LastPlayedPreviewClip to get the last clip
EditorAudioUtility.PausePreviewClip(AudioClip audioClip);
EditorAudioUtility.ResumePreviewClip(AudioClip audioClip);
EditorAudioUtility.StopPreviewClip(AudioClip audioClip);
// Stop all clips
EditorAudioUtility.StopAllPreviewClips();