I initially searched around the forums for others that are in the same boat I’m in but didn’t quite find what I was looking for. If however there’s a thread about this, I apologize - just point me in that direction.
That been said, I’m building an extension library using monotouch (just to start as there will likely be other extension libraries but anyways…) and I’m wondering about how to go and link the two.
I’ve made my monotouch library and placed that into my Assets/Plugins folder and am capable of using the classes and functions within the library’s namespace. It compiles without error.
From what I currently understand is that to test the library, this can only be done on the device so there’s no use in trying to run it in the editor using unity remote since I know that won’t work.
So I make a build of the game but right at the end, the last stage of unity’s building process I get an error about how I’m missing the actual monotouch assembly. I receive a file not found error. I tried copying the monotouch.dll over into my plugins directory but still that wasn’t enough since I got new errors about how it couldn’t access classes and so forth.
Obviously there must be a proper way of doing this. My knowledge and understanding of using and importing dll libraries is good since vie spent most of my career coding on the PC. My knowledge however of Xcode and the way it deals with libraries is something I’m still working on.
Has anyone been able to combine a monotouch library with their Unity project?
Since they’re both in c# can I expect to use the classes and nameapace within unity? Or am I going to have to write exportable c style functions to access the code within the library?
Linking. Is there something I need to do in Xcode that specifies to include the monotouch library?
I would very much like to hear from anyone who has or is, trying to do the same thing I’m doing.
I’m guessing that with the lack of replies and from other sources ive read that doing this is simply not possible.
The only other way I guess would be to write an iPhone OS library (static library) that would internally handle my needs. Then export those functions to import them into Unity,
The static library would have to contain code written in objective-c to perform what we need it to do. Then we’d have to export a few standard c style functions that would allow the library to hook up with our unity code.
If the library were static it would at least contain all the dependancies within the library since I believe the problem centers around the fact that generation of dynamic code or linkage is what prohobits the use in the first place…or so I thought.
What I meant is that you must ensure to contain the binding code in source form, not just drop in the precompiled static library with the project
That being said, nothing prevents you from dynamic linking, all iOS Frameworks are bound like this.
What Unity does not work with is static libraries that were thumb compiled.
I think this functionality would be really awesome for Unity to get working and would make Unity considerably more valuable. Instead of Unity being just a game engine, it would rather be the game engine and 3D component to a framework that can do much more.
I’m sure it would be alot of work. But I imagine something like, in MonoTouch you could create the Unity game engine window as it’s own self contained object, then you could send things from monotouch into Unity, and then send things from Unity to monotouch. Basically how it works right now with Xcode interopting with Unity. Then Unity would just use all the mono libraries included with Monotouch, so it doesn’t take up more memory. Such a package would be incredible.
Unity comes with a n own custom modified Mono, not MonoTouch nor anything related to it and that will not change, ever I would expect as it has a lot of stuff that unity just does not want or that make it incompatible to the mono as used on other platforms.
Unity focuses on cross platform, not single platform as monotouch