It appears Unity does not support Objective-C. Any coding would need be done in Javascript or C#. In addition, I am ‘locked’ into the Unity framework with respect to accessing the iPhone SDK. I.e. it would not be possible to have part of my application being Unity coded and part of it being Objective-C coded (and accessing the iPhone SDK…e.g. for Bonjour networking).
I can work with these limitations but wanted to be clear about them up-front.
There is thought a workaround for things that don’t need to be “instant”. Thats communication through PlayerPref (in unity) / user files (on the obj-C end) and send commands that way.
This can for example be used to show the keyboard, catch images from cam, select images from the image library and alike.
It was mentioned throught that it is planned for iPhone Advanced to be able to expose Obj-C functions to Unity’s scripting backend in a future version, so this restriction is not planned to be a permanent one.
Great to hear progress is being made on the Obj-C integration side. Wonder how long it will take to release the advanced kit?
I really want to lock in a game engine rather than keep coding my own physics and such. It’s hard to choose at this point because all the different engines have their own unique benefits/quirks. It will settle down to a couple winners…just trying to make sure I back the right one.
You write your game in c# or JS, but you’re not really “locked” out of Objective-C. Unity builds a standard iPhone SDK project for you, which you compile and run in XCode. So, you can edit the files that Unity outputs and add the features that you need.
There are a dozen little gotchas involved with doing this, which is why I sell the Enhancement Pack (can’t go a day without mentioning the thing). You can’t call directly between the objective-c and Unity layers, so it’s not clean. But it certainly works. There are several Unity-based games in the app store that include enhancements from the Objective-C side.
I have been working on adding bonjour match-making for a game I’m working on. I’m planning on doing the bonjour service pub/discovery in objective-c, and simple pass the other player’s IP address back to Unity, where we’ll use sockets for communication.
Hello, first post. Looks like great stuff going on here.
With regards to editing files…
Any chance you can be just a tiny bit more specific?
I’m close to buying the iPhone version but I’m concerned about being able to pass values from my c++ code over to unity. All my multiplayer engine code is in c++. I don’t mind hacking around in source if source is given. But I’m really keen to be able to use my c++ libraries for non graphical stuff.
Can you give me an idea of what a typical Unity produced XCode project looks like? Is it a few Objective C source files and then lots of precompiled object modules or is it all source or ?
zman, bliprob probably has more expertise in this area, but I would say get the Unity iPhone evaluation license, and try inserting your code . AppController.mm is already a C++ file. Basically you pause the engine and pass information through NSUserDefaults + PlayerPrefs. That is what the stinkbot enhancement pack does. I would be concerned about performance issues with multiplayer C++ code using this method. Because there is no facility (yet) for wrapping native code from Unity scripts.
Thanks. My stuff would be running in its own thread so I’d not want to pause the engine.
I see that NSUserDefaults could be used, maybe that would be fast enough. I’m really interested in some kind of direct memory transfer via a pointer to a structure.
I’ve got the regular unity eval right now and I’m running through Will Goldstone’s video tutorials. I didn’t see an iPhone eval - do you have a link?
Unity for iPhone doesn’t support that at the moment. Based on what’s been said by Unity employees in other threads, you can expect some capability to do this in the next release, which based on what’s been said by Unity employees in other other threads, should be sometime in March or April.
What are trying to do? There are limitations to what’s possible in a background thread (i.e. you can’t do GUI stuff) in Cocoa.
My background threads, among other things, use asynch sockets to pass data back and forth to a server. I’d want to be able to update the x,y,z position of a 3D sprite using this information.
When I do gui stuff I use OpenGL for 2D blitting,
and handle all the touch stuff myself.
We’re already working on both Unity 2.5 and a Unity iPhone 1.1 update. Unity 2.5 is shipping in the GDC time frame (roughly, GDC is late March). Within a month or two of that we’ll then release the Unity iPhone update (so it could be April or May). That update will include new abilities to incorporate Objective-C code into the XCode project and expose that to scripting. Do note that this new functionality will be available in Unity iPhone Advanced only.
It was reference as the version that would likely add it.
But UT has never provided any date or even timeframe for it to happen unless I’m completely wrong (which I don’t assume as UT does not hand out any anywhere precise estimations on minor releases ie 1.x / 2.x releases until they are ready to ship)
Unity 2.6 shows this pretty well with an estimated timeframe “this summer” which means between now and sept / oct basically
The only potential timeframes given back then were for 1.0.2 to adress a few problems.