I recently purchased a plugin(Audio Motors) and have been struggling to figure out how to use it in my game.
I’m wondering what I need to do to register this plugin, and also if I can do it with the old legacy integration?
I have just upgraded from using the legacy v1.07.06 integration for unity, to the new 1.08.13 V2 integration. Before the upgrade and installation of the plugin I had a perfectly working sound system for my game, in that I could build it and have sound working on my device fine with minimal configuration. (I’m working on a racing game for Android. With the legacy integration and no plugin, I didnt have to configure anything platform specific, it seems that with the new integration and possibly also because of the plugin I might need to do some platform stuff).
Before this plugin I was creating an event in the authoring tools and transitioning between static audio clips of engines at different rpms. All I had to do with the legacy integration was build my banks from inside the Fmod Authoring Tools and then import them into unity. From there I could control the parameter attached to my event inside the bank, through c# at runtime. Once I built my banks after implementing the plugin and tried to run my game, I got an error. I believe it was ERR_PLUGIN_MISSING. I couldn’t find any obvious way to fiddle with any plugin configuration in the legacy version so I upgraded to the new 1.08.13 V2.0 integration, mainly because I saw a plugin section in a screenshot and thought that might be the way to go. It seems very different from the legacy integration. I haven’t been able to figure anything out yet and right now I’m just clicking away in the dark so to speak.
I read an article deep in the documentation that briefly mentioned editing fmodplugins.cpp in the Plugins folder for unity. Any documentation that I could be provided with on this would be hugely appreciated. I’m hesitant to start inserting lines of c++ without any instructions. I have been provided some c++ code and a header file for registering the plugin so I think this is probably the way to go to get the plugin working.
I really appreciate any help on this.
I found this… It seems to have done the trick.
I’m targetting android, however I’ve been provided an x86 and x64 titled versions of the plugin so I put the x64 version in the Assets\Plugins\x86_x64 folder (Android folder is full of native android files like .so and .jar etc. Also I added the name of the .dll file to the fmod_listener plugin list. ERR_PLUGIN_MISSING has gone away. Except now I have some unexpected null reference exception errors when trying to retrieve an event parameter using -
engine.getParameter (“RPM”, out engineRPM);
I’ve added #define FMOD_DEBUG to the top of my script to see if I get any useful information, but nothings coming through.
Since registering the plugin I’ve been able to play my event on awake using the event emitter but I need to be able to create the event and control it from script.
Any ideas what might have changed? Parameter is created just as I would normally. Listener is added to the scene as well…
You’ll need to contact AudioGaming to get an Android version of the plugin. The windows .dll won’t work on Android, as you’ve discovered.
Thanks for the help Scott, I’ve done so and now received the android version from them. How should I go about configuring the plugin for debugging in windows AND building to the android device? (When I’m debugging and building on my PC inside the unity player I specify the audiogaming_audiomotors (.dll file) in the Fmod listener plugin path field.) When building the apk for the device should I change the name of the plugin in that field to the android library name? I’m thinking I could make a simple script to adjust the name inside that fmod_listener plugin path depending on if I’m debugging or running on the device. Just wondering if there’s a proper approach to this.
I made a quick build right after I got the android version, I changed that plugin path field to libaudiomotors_fmod_studio_shared (name of the file, placed in Plugins\Android) and it gave me an error at runtime on the device.
I’m assuming you’re still using Unity V2 integration. In Unity, go to menu “FMOD” -> “Edit Settings” and find the “Plugins” setting in the Inspector. Hit the “Add Plugin” button and type in the name of the AudioMotors plugin without any file extension e.g. “audiogaming_audiomotors”. When you build for Windows, FMOD knows to look for “audiogaming_audiomotors.dll” and when you build for Android it knows to looks for “libaudiogaming_audiomotors.so”. If the Android plugin you have is not called “libaudiogaming_audiomotors.so”, rename it so it is.
No, sorry forgot to mention that. I tried out the V2 integration because I wasn’t sure if the plugins would work properly with the legacy integration. Once I figured out the legacy plugin setup I stuck with that. I renamed the file as you said but I’m still getting some errors on the android device. I did some debugging tonight and found an interesting warning as well as the plugin missing error…
W/Unity ( 9880): FMOD Error (ERR_PLUGIN_VERSION): A plugin was built with an unsupported SDK version.
E/Unity ( 9880): Bank Vehicles.bank encountered a loading error ERR_PLUGIN_MISSING
If any information from my Android SDK Manager would be helpful I can provide that.
I’ve been trying all kinds of different folders within Plugins\Android. I tried putting it in the root folder but that didnt work, I don’t see any .so plugins, only .aar in that folder. So from there I went to Plugins\Android\libs\armeabi-v7a\libaudiogaming_audiomotors.so and also Plugins\Android\libs\x86\libaudiogaming_audiomotors.so.
ERR_PLUGIN_VERSION suggests that the AudioMotors plugin you got from AudioGaming was built with a newer version of FMOD than the version you’re running, which I’m assuming is 1.07.06 as you mentioned earlier?
If you get on the latest 1.08 version of FMOD Studio/Unity V2 integration, it should all work.
I have a similar problem with getting and setting parameters of AudioMotors in Unity.
Have you found the solution?
I’ll take a look tomorrow and see what I can find. I did find a solution for this about a year ago I believe. I received multiple versions of the audio motors dll and fmod studio. I can’t remember exactly how i did it off the top of my head, only that it was an extremely severe headache to figure out initially.
What stage are you at so far? You’ll have to make the car data in the audio motors vst and then export it, then you can right click, I believe, somewhere on the audio track of your event and select add plugin sound -> audio motors. From there you make your parameter and it works just like controlling any other fmod parameter in Unity. Is it just controlling the parameter via script that you’re having trouble with?
Also the audio motors plugin has to be in the unity plugins folder, that part I’ll confirm tomorrow as to which folder to put it in. I initially didn’t think it would have to be in there to work because it seemed like audio motors was just a vst used to produce some data for fmod, and not actually used at runtime. However it does need to be in your plugins folder somewhere.
Let me know exactly what you’re trying to do and I’ll see if I can help.
Thank you very much for your quick and detailed response.
So far I can play an audio event created in FMOD Studio in Unity. The event contains an AudioMotors instrument in the Timeline tab. If I add automation to parameters such as RPM in FMOD Studio and rebuild the event, I can hear the sound played in Unity varies just like what I heard in FMOD Studio.
And then I removed the automation and tried to set parameters, say RPM, in Unity through the integration API, like:
FMODUnity.StudioEventEmitter emitter = GetComponent<FMOD_StudioEventEmitter>();
in MonoBehvaiour.Update(), but the sound did not vary and just kept playing the same tone.
I know there is a way to create custom parameters by adding tabs besides Timeline tab in FMOD Studio, but I don’t know what the next step is. Maybe mapping the custom parameter to that of AudioMotors or somewhat else?
The SetParameter function (like most FMOD functions) will return a FMOD_RESULT, checking this may help pin point any issues you have.
Adding automation to an event property isn’t the same as a property.
It sounds like what you need to do is add automation to a property, eg. RPM, add a parameter to the event and use that parameter to drive the automation values of the property.