If I have a completed web based unity 3d game that doesn't have high polycount and high draw calls, would the .js code have to be completely re-written To make iPhone version or is it usually a matter of coding the touch inputs via the unity iPhone plugin? I suspect tweaking is needed but I wonder if it's major.
The changes to control your game using the iPhone's touch and tilt controls are certainly going to be a fair amount of work, and there are certain features which simply aren't supported on iPhone, such as the terrain engine, pixel shaders, render-to-texture. Dynamic typing of variables is also not supported, so you will have to convert your code to use statically-typed variables. Depending on how you wrote your code initially, this may be significant work.
But in addition - and I would say most significantly - you should never underestimate the amount of optimisation that you'll need to get your game running at a decent speed on an iPhone.
Even if you think your game has a fairly low poly count and draw call count, or is fairly well optimized, until you have actually tried developing for iPhone you could still be in for a shock.
Many iPhone developers find that they have to go to great lengths to optimize their game if it was previously written for webplayer or Mac/PC standalone. If you haven't done this before, you may end up having to learn a lot more about code and scene optimisation before you start getting a decent frame rate. Here's a random handful of common techniques off the top of my head, which iPhone developers tend to use to squeeze out the last drop of performance. These are in no particular order, and each one could be expanded on in much more detail.
For more information, do some broad searches around the subject of iphone optimsation. For example:
Having re-read this, I feel I should stress that I'm not saying it's always a huge effort to rewrite a game for unity iPhone. Many of the above-mentioned optimizations are things that seasoned developers would make use of in a non-iphone game too and should already be familiar with. So if you understand and have experience of these things already, then in all likelihood it will be just as much fun porting to iPhone as it is in regular Unity!
My answer is mainly aimed at those developers who are new to Unity and new to coding in general, who might not be aware of this kind of stuff - because when coding for desktop builds you have far more leeway in which less-than-optimal code and graphics will still run at a very fast speed, and it's these areas which will trip you up if you try to do the same on iPhone.
And I'd like to add that the simple fact that you can publish from the same Unity project to both Mac, PC and iPhone at all is undeniably awesome.
If the app doesn't require much performance optimizations then major focus would be the new input. The rest shouldn't really give you much trouble.
answered Jan 12 '10 at 05:47 AM