- Home /
Can Unity Iphone game be written in C#?
Can Unity Iphone game be written in C#? Do I need MAC OSX to do this?
Answer by jashan · Jan 03, 2010 at 11:09 AM
Unity iPhone games can be written in C# or UnityScript (aka JavaScript ;-) ). More precisely, you can do all scripting for Unity iPhone games in those languages (it's not like XNA, for instance, where you would code the game more or less "from scratch" because you have a very nice and optimized native game engine "under the hood"; however, the Unity API that you use for scripting is generic enough that this doesn't cost you any freedom - it just makes things quite a bit easier).
You do need a Mac for any kind of serious iPhone / iPod touch development; and you also need the Apple DevKit and be in the Apple iPhone Developer Program which costs $99 per year. The reason you need all this is that Apple only allows applications built with XCode on the iPhone. So, what Unity iPhone does is: It creates an XCode project that is then automatically built and deployed to the device where you can test it. Sounds complicated, and it sure is - but Unity hides the complexity very nicely, so it's not a big deal.
However, you need to have the Apple iPhone Development kit set up and also need the certificates that you can get from the Apple iPhone developer portal (which you can access as soon as you are a registered Apple iPhone developer) - it's very advisable to set all this up even before you download the Unity iPhone trial. You also need the iPhone development kit and those certificates for deploying Unity Remote to the iPhone / iPod touch which makes it possible to "play-test" and debug your game without the more involved build-cycle (it's running in the Unity editor then, with the display streamed onto the iPhone and the input-data like touches and accelerometers sent to Unity; the quality of the streamed video is not ideal but it's "okay enough" for most use cases).
Of course, you'll still need to do on-device testing but having a way to very quickly play/tweak with Unity Remote certainly speeds up the workflow.
Theoretically, you could build a game with Unity on a Windows-PC and then at a later point in time take that project into Unity iPhone and create the iPhone version with Unity iPhone on a Mac. While that's possible, I wouldn't recommend it because game development on the iPhone is very different due to the comparatively limited capabilities (compared to a desktop PC). And unless you already are an experienced iPhone developer, you'll probably have to do a lot of optimizations very late in the process if you don't start with Unity iPhone and on-device testing right away. You might even end up realizing that what you created simply won't work on the iPhone (it's really a matter of understanding the device - if you have that understanding, there'll still be some tweaking necessary but it won't give you severe trouble).
Answer by Ricardo · Jan 02, 2010 at 03:54 PM
Yes, but as you're writing to .Net 1.1, you won't get any generics.
Answer by maxfax2009 · Jan 02, 2010 at 05:24 PM
and you need a Mac computer to build for the iPhone
plus it makes sense to have a iPhone or iTouch to test.
Answer by Dmitry · Apr 18, 2011 at 08:15 PM
But, how does it work? Does it translate C# into Objective C and/or C/C++?
This is purely an educated guess, but it would seem likely that Unity simply packages the $$anonymous$$ono runtime with each game, just like on other platforms (well, except for Flash.)