I have a Unity asset that switches output buses at runtime. Unfortunately someone has reported to me that this switching is causing large spikes in CPU usage:
The code that’s running during that spike looks like this: SwitchOutputBus.cs · GitHub
Basically this is doing:
- Unlock previously locked bus
- Lock new output bus
- Switch the channel output to the new bus
Is there anything wrong with this approach that might be causing the high CPU usage?