Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity3d - ios duplicate method found with fmod

I am using an fmod plugin for Unity3D. Compiling to Windows and OSX is fine because I can dynamically load the DLL/dylib. The problem comes when I compile for iOS. I use

[DllImport("__Internal")]

Because iOS requires statically linked libraries. When I compile though I get a

SystemException: Duplicate native method found : FMOD_System_CreateSound. Please check your source carefully.

I am quite sure I don't duplicate the symbol. I think this might be due to the fact that Unity imports FMODs itself and that the two might be colliding... But if this is the case, I am surprised that FMOD_System_CreateSound is the first one to get caught. Is there a way around this? thx!

As always, I will be happy to provide any additional details!

Here is a sample project that will cause the error: Sample Unity Project with FMod

EDIT: The conflict was caused by iOS not allowing functions to have the same name even though they don't have the same signature. After removing the same-named functions (thus removing some FMOD features that I didn't need), I can compile to iOS, but as expected, I still get an error when Initializing because FMOD is already initialized by Unity.

like image 668
David Menard Avatar asked Oct 21 '22 13:10

David Menard


1 Answers

Unity3d already has a limited version of FMOD that is bundled with it, which is causing the conflict you are seeing. Unfortunately, it doesn't seem possible to disable it at this time, so that you can use the full version of FMOD

like image 140
JoeCortopassi Avatar answered Oct 28 '22 16:10

JoeCortopassi