Experimental support for Unity native audio plugins on the develop branch


#42

@daniel I am familiar with git and I was able to download that repository using the line of code you suggested. However, when I create a plugin with this version of JUCE in the Projucer, I don’t see an option to enable Unity. Do you know why that might be?


#43

You need to build the projucer yourself, it’s in JUCE/extras


#44

Thanks. That got it to show up.


#47

Is it possible, using this experimental appraoch, to get unity’s transformation matrix (x,y,z & rotaion & scale) into the plugin?


#48

No the Unity plug-in API doesn’t provide this. You could expose parameters for these values and modify them from a Unity script though.


#49

@ed95 Nice work with this.

One thing I’ve noticed is a small bug for plugins with spaces in their names. For example with a plugin called “My Plugin”, a class called audioplugin_My PluginGUI will be created in the UnityScript.cs. This causes custom GUI loading to fail. I think whatever is generating the .cs file needs to sanitise the name string, removing spaces (or any other characters not allowed in a class name).

Jamie


#50

I’ll get that sorted out, thanks!


#51

@ed95 I found out by accident that juce_Unity_Wrapper.cpp doesn’t compile with Visual Studio 2017 (I haven’t tried another version of VS) when compiling for Win32. I made a PR with the fix:
https://github.com/WeAreROLI/JUCE/pull/444


#52

Thank you, I’ll get this fixed.


#53

Hi ed,

great to have support for Unity audio plugins. Thanks for putting in the work!

I’ve encountered a slight problem during code signing on macOS:

unsealed contents present in the bundle root
Command /usr/bin/codesign failed with exit code 1

this is because the .cs script is copied into the bundle root. This could be fixed by copying the script a little deeper by setting Subpath to ‘Contents/Scripts’:

image

thanks,
Ben

PS.: or don’t copy the .cs file ? It seems I have to move it out of the bundle anyway for Unity to pick it up.


#54

Are you sure? I haven’t experienced this being an issue before, Unity seems to do a recursive scan of the .bundle and picks up the script OK.

I’ll take a look at the code signing issue.


#55

Unity doesn’t seem to recognise the plug-in when copying the GUI script to Contents/Scripts so after some testing it seems like the best place to copy it is the Resources section of the bundle - the code signing works correctly and the plug-in loads up in Unity.

I’ve pushed this here, you’ll need to re-build the Projucer after pulling and re-save your project.