I’m using this physics library written in C++ in my game. I’ve written a plugin for it for windows and Android. I’ve achieved this by building the library for the target device into .dll and .so files and including a new .cpp file with the extern ‘C’ functions that I can call from Unity C#
Now I’m trying to get it working on iOS. It seems a lot harder to do this. I’m hoping someone whos done this before can advise me on which option to take and whether I am on the right track. I’m looking at two options.
-
Use the ‘Automated plugin integration’
This involves putting the source .ccp and .h files into theAssets\Plugins\iOS folder.
Unfortunately it does not support subfolders so my plan is to flatten the directory structure of the whole library so I can put everything in one folder. My idea to do this is to use a python script that will change all the include statements in the source code so for example…#include <Box2D/Common/b2Settings.h>
would be changed to…
#include <b2Settings.h>
Note: This library is a superset of Box2D so its relatively large and complex.
Also I’m a bit worried about this as there have been reports from 2013 on stack overflow saying that the Automated plugin integration for iOS has been broken since unity 4
- Build to a .a file and use it the same way I have done with windows and Android.
The project already comes with an xcode project for building to OSX. I might be able to change the build target to iOS, though I gather that I would have to add a .h file with my external ‘C’ functions… Also the documentation / example they give is confusing me. They dont use this method and only seem to include the source code files in assets so I’m not sure if this method is even possible.