Overwrite the file’s content with the following (feel free to remove the comments):

Although we’ve added some of the plugin’s logic, we still need to register the plugin with the SDK so switch over to PluginList.h (should be empty) and add:

You’ll notice that the effect declaration is guarded with the UNITY_OSX macro. Native plugins require building on all platforms that they’ll be deployed on so you can use the if guard to prevent your plugin from being built on incompatible platforms. I haven’t tested this noise plugin on Windows, but as far as I know, it doesn’t make any OSX specific calls, so theoretically it should compile on Windows with msvc.

Because we’ve now included AudioPluginUtil.h in a compilation unit, the project won’t successfully build until we’ve added all the necessary callbacks for the plugin.

Go back to Plugin_Noise.cpp and add callbacks for plugin creation and deletion:

UnityAudioEffectState* state is a pointer created by the SDK that gets passed into all the callbacks. You should store any of the state that the plugin relies on within the void* effectdata member.

Next, let’s add the callback that does the actual processing for the plugin:

ProcessCallback is continuously invoked by Unity with the effectstate , an incoming audio buffer, and an outgoing buffer that needs to be filled.

The audio buffers interleave channels: for the nth sample in the buffer the signal amplitude for channel c (zero-indexed) is found at buffer index [n*numChannels + c] . For example, with a stereo buffer (2 channels), the left channel for the nth sample is at index [n*2+0] and the right at [n*2+1] . Signal amplitudes should be normalized to values within the range [-1.0, 1.0] .

We’re almost finished, all we need to do is add callbacks to handle parameter manipulation from the editor:

Putting all these snippets together, the final Plugin_Noise.cpp file should be:

And PluginList.h should have:

Once the files are correct, the build should succeed and place a .bundle in Assets/Plugins . If the build fails with a Code Sign Error, try cleaning ( Product -> Clean [cmd+shift+k] ) and rebuilding.

Here’s an archive of the Unity + Xcode project files up to this point: