EditorAudioUtils icon indicating copy to clipboard operation
EditorAudioUtils copied to clipboard

[Suggestion] Also add sound for compiler errors

Open jerome-poenisch opened this issue 1 year ago • 1 comments

Hey there, first of really cool tool! I very much agree on the Unity Editor lacking a bit on sounds notifications especially for failing/succeeding builds you let run in the background and that take a while. And your solution is even also custom adjustable for each local user 🤩

Just a small idea for an extension on top - I did this modification for me locally:

  • Also add sounds for a failing compilation. For example like

    public static class CompilerNotifications
    {
        [InitializeOnLoadMethod]
        private static void Init()
        {
            CompilationPipeline.assemblyCompilationFinished -= ProcessBatchModeCompileFinish;
            CompilationPipeline.assemblyCompilationFinished += ProcessBatchModeCompileFinish;
        }
    
        private static void ProcessBatchModeCompileFinish(string s, CompilerMessage[] compilerMessages)
        {
            if (compilerMessages.Any(m => m.type == CompilerMessageType.Error))
            {
                EditorAudioUtility.PlayCompilerNotificationSound(EditorNotificationSound.Error);
            }
        }
    }
    
  • [optional] And then optionally I also added according enabled flag - so two different flags (either bools or enum flag). I therefore also split out the PlayNotificationSound into PlayBuildNotificationSound and PlayCompilerNotificationSound. Might be fine as well though to just stick to a central single one.

jerome-poenisch avatar Feb 01 '24 10:02 jerome-poenisch

Heya @jerome-poenisch ,

Very nice addition. I added your suggestion to version 1.2.0 - With success and fail sounds for compilation and builds.

JohannesDeml avatar Feb 04 '24 21:02 JohannesDeml