DllNotFoundException with simple Unity audio plug-in when using custom editor

Some important info:

  • Unity 2021.3.3f1.180 on Windows 10
  • JUCE 6.1.6
  • Tried putting the plug-in in ~/Assets/Plugins in Unity, as well as ~/Assets/Plugins/x64 & ~/Assets/Plugins/x86
  • Tried both 32 bit and 64 bit versions of the plug-in
  • Tried placing generated .cs file next to the .dll, as well as above/in different ~/Assets folders

When building a Unity plug-in I can get Unity to see the audio plug-in and I can instantiate it on a Unity Audio Mixer, however any time I try to create a plug-in with a custom editor, Unity always returns a DllNotFoundException from code within the generated C#/.cs file that wraps the custom editor code for Unity.

Basically it is saying Unity can’t find the C++ .dll file that stores the Unity native audio SDK plug-in from the generated C# class when trying to interop with the .dll, which is weird, because Unity already can see and instantiate the audio plug-in, which means that .dll file was found and loaded.

The Unity Editor exception looks like this:

DllNotFoundException: audioplugin_PrismDecoder assembly:<unknown assembly> type:<unknown type> member:(null)
audioplugin_PrismDecoderGUI+PluginGUIInstance.repaint (UnityEngine.Rect r) (at Assets/audioplugin_PrismDecoder_UnityScript.cs:54)
audioplugin_PrismDecoderGUI.OnGUI (UnityEditor.IAudioEffectPlugin plugin) (at Assets/audioplugin_PrismDecoder_UnityScript.cs:171)
UnityEditor.AudioMixerEffectView.DoEffectGUI (System.Int32 effectIndex, UnityEditor.Audio.AudioMixerGroupController group, System.Collections.Generic.List`1[T] allGroups, System.Collections.Generic.Dictionary`2[TKey,TValue] effectMap, System.Int32& highlightEffectIndex) (at <31b86d204baf45de8328f2d1261a79f7>:0)
UnityEditor.AudioMixerEffectView.OnGUI (UnityEditor.Audio.AudioMixerGroupController group) (at <31b86d204baf45de8328f2d1261a79f7>:0)
UnityEditor.AudioMixerGroupEditor.OnInspectorGUI () (at <31b86d204baf45de8328f2d1261a79f7>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <b48cdb53cee144a28e4b5acdbf8f4e58>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I’m doing this with a fresh JUCE audio plug-in project with only Unity selected as the plug-in type, without any real modifications to the code, just leaving the boilerplate stuff the default “Hello World” custom editor.

It seems right now with the latest version of JUCE and Unity on Windows it’s impossible to use a custom editor with a plug-in.

Am I missing something? Has anyone else seen this? Thanks!