Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
6
Question by peter · Jan 12, 2010 at 05:23 AM · iphoneoptimizationdrawcalls

What are the implications of re-writing or porting a game to the iPhone?

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
16

Answer by duck · Jan 12, 2010 at 12:08 PM

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.

  • Reduce poly count and draw calls right down. I've heard reports of 70 draw calls running at a good speed, but really you probably want to aim for less than half that if you'll also have any significant physics and scripting in your game.
  • Use pools of reusable objects, rather than instantiating objects during play
  • Avoid physics that involve many objects clumping together
  • Increase the physics timestep as high as is tolerable
  • Remove most (or all) lights from your scene. Use baked lighting instead.
  • Pack as much as you can together into texture atlases, to maximise material sharing.
  • Use built-in arrays rather than dynamic arrays
  • Cache references to everything that you possibly can (eg, components), to avoid lookups during play
  • Manipulate many small objects from a central controller, rather than many small Update()'s
  • Use sprites combined into a single mesh (a la SpriteManager)
  • Use a single combined mesh with bones to animate the positions of separated submeshes as if they are separate objects.

For more information, do some broad searches around the subject of iphone optimsation. For example:

Custom Google Search for iPhone optimisation

Unity Answers search for questions tagged iPhone optimisation

edit (addendum):

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.

Good Luck!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Jaap Kreijkamp · Jan 12, 2010 at 05:47 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Small Vert/Tris count still generating more draw calls than expected 1 Answer

Few questions about optimizing graphic performance for mobile devices. 1 Answer

Batching problem when using multiple materials in one model 1 Answer

help with iphone 3GS performance (polys and audio) 2 Answers

Large level loading best practices 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges