Heads up for anyone porting Cabbage .csd patches to CsoundUnity.
I’ve been adapting some of Iain McCurdy’s examples (River, Electricity, etc.) and ran into two issues that took me a while to debug.
1. Widget defaults don’t initialize channels in CsoundUnity
In Cabbage, widget defaults from range(...) automatically populate channels.
In CsoundUnity, chnget returns 0 until something explicitly writes to the channel.
This means many patches stay silent until you touch a slider.
Fix: initialize the channels manually with chnset at the top of the instrument:
chnset 1, "Gulp"
chnset 3, "GulpLev"
chnset 80, "GulpPitch"
After Unity starts sending values, those defaults get overridden normally.
2. cabbageSet / cabbageGet won’t compile
CsoundUnity doesn’t include Cabbage-specific opcodes, so anything like:
cabbageSet "IDRiver1", "tableNumber", 1
needs to be removed or handled from the Unity side.
In my case these were only updating graphics widgets, so deleting them was fine.
Also: keep the <Cabbage> block. CsoundUnity uses it to auto-generate inspector sliders.
After those two fixes, River worked perfectly in Unity with full inspector control.
Happy to share the converted .csd if useful.

