Windows to mac project: audioSources stop working
There is a problem with the AudioSource output in a project opened on Mac.
Broadly speaking, there are two scenes: a bootloader with intro videos and a brief start screen, and a main scene with the game. On Windows, these two scenes work perfectly, as well as the transition between them (an async scene load). The build for Windows standalone works perfectly as well.
Opening the project on Mac, though, has the following issue:
- If you play the bootloader scene, audio works perfectly up until the scene swap. Then, there is a "pop" on the speakers, and all AudioSource-related audio stops working. From that point on, if you play the bootloader scene, all AudioSource-related audio will not work, and it will only work again if you close the editor.
- If you play the main scene first, there is a "pop" on the speakers, audioSource-related audio stops working. From that point on, no matter what scene you play, AudioSource-related audio will not work until you close the editor and open it again.
- If you open the AudioMixer (which is set up with some Audio Mixer Group Controllers), none of them is receiving input from the AudioSources (the volume bars do not animate).
- These problems translate to the game build as well: once you transition to the second scene, nothing can be heard.
So, there is something in the main scene that is breaking the audioSource output, that does not break it on Windows. We have tried all of the troubleshooting we have found on the internet (reset/modify project audio settings, check for accidental mutes, check for assembly issues with the audio-related components), etc.
Two things made audio to work once, before breaking again in the next scene play:
- Creating a new audioSource on the scene made the audio work. Next time we played the scene, AudioSources weren't playing anymore, and creating new AudioSources did not replicate the solution.
- We found out that, on the MacOS standalone target platform, Visual Studio marked some errors with the audio management classes that didn't show up in the Windows target platform. these errors were related to assemblies and namespaces.
[ as a sidenote: these errors should have appeared on Unity as compilation errors, because the errors that Visual Studio displayed were on the "class not found" tier - yet no error was shown on the unity console ]
We fixed these issues by assigning assemblies and namespaces to all audio-related scriptables and classes, and made sure that Visual Studio did not show any further errors. Right after doing this, the audio worked once. Then, on playing the scene again, audio wasn't working anymore and didn't work since.
This is too strange, and I would be very thankful for any insights you may have on this.
Your answer
Follow this Question
Related Questions
Sound bug - Emergency HELP 0 Answers
Unity 2019.4 LTS opens multiple windows for one project 0 Answers
"Failed to load window layout" Error 5 Answers
WindowsVideoMedia Error 0X8007000e Wat dis do? 2 Answers
Mac build crashes on fullscreen 0 Answers