Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by DFiable · Aug 21, 2011 at 04:54 AM · androidslowdrawcalls

Painfully slow on Android?

My game works perfectly on the PC and on the Web, but as soon as I demo it on an Android phone its running like a flip book. My Drawcalls are 375ps. All my code is in Javascript. There are only 4 main moving objects in the game. and about 36 static walls. 3 lights. Do the project files that are not being used in the game affect the speed? Its completely unacceptable. I've created a First person tunnel game so the FPC is always in foward motion. Does anybody have any ideas why the game play is like swimming in quicksand? Could it have anything to do with the way I loaded the JDK and the SDK? This is the first time I've run the game on the phone(Android)? Any suggestions? Thanx

Here is the forward motion script I'm using(its from the Tunnel Runner Demo)

 var rotateSensitivity : float = 4.0;
 var moveSpeed : float = 6.0;
 var controlCurve : ControlCurve;
 private var rotationCurve : AnimationCurve = AnimationCurve.Linear (0,0,1,1);
 private var acc : Vector3 = Vector3.zero;

 function Awake (){
   
 // In order to make the feel of the player controls
 // consistent in all levels, we set this property in awake.
 // This way, each level's instance of the camera can inherit response
 // curve that has been set up in the Prefab called "Control Curve"
 
 // Note: To edit the master response curve, select the
 // "ControlCurve" Prefab in the Resources folder, and
 // select GameObject->Edit Response Curves from the menubar
 rotationCurve = controlCurve.controlCurve;
 
 // Set Phone to widescreen mode
  Screen.orientation = ScreenOrientation.LandscapeLeft;

}

function Update (){

 // Move the camera and children forward
 
    transform.Translate (0,0, Time.deltaTime * moveSpeed);

}

function FixedUpdate (){

 // Smooth out the value coming from the device
 
        acc = Vector3.Lerp(acc, Input.acceleration, 0.65);
 
 // Determine the final value of rotation based on the response curve
 
        var filteredRotation : float = rotationCurve.Evaluate (Mathf.Abs (acc.y));
 
 // Invert the evaluated rotation value if we're rotating left instead of right
 
         if (acc.y> 0){
 
         filteredRotation = -filteredRotation;
 }
 
 // Apply the final rotation
 
    transform.Rotate (0,0, filteredRotation * rotateSensitivity);

}

Comment
Add comment · Show 2
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 DFiable · Aug 22, 2011 at 01:13 AM 0
Share

I reduced my drawcalls down to 215 and its slightly better but its still not acceptable. Its like stop action and very very jerky. Any suggestions would be appreciated. Thanx in advance.

avatar image DFiable · Aug 22, 2011 at 10:32 PM 0
Share

Do you need to have Android Pro?

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by kromenak · Aug 23, 2011 at 01:30 AM

I'd guess that you have way too many drawcalls. Our game currently has a maximum of maybe 40 draw calls at any time, and even that is pushing it a bit. You should really be trying to keep your draw calls within the 20-30 range.

Since you have way more than that, you might want to explore ways to reduce this. Here are some possibilities:

  • If you have static items, mark them as static and use static batching (unfortunately, a Pro feature).

  • If your dynamic items have more than 300 vertices, they will be batched if they share a material.

  • Skinned meshes can't be batched; major hog of drawcalls if your game requires them!

  • Try to get as many objects as possible to share materials.

  • Reduce the number of objects on-screen at any one time.

  • Sometimes the z-order of objects can affect the number of draw calls.

  • Sometimes it seems that objects that are not of 1,1,1 scale do not batch.

You may also look into using simpler shaders. Using highly specialized shaders on your objects as opposed to generalized ones can make a big difference; a recent pass on our game's shaders gave an ~10fps boost!

Also, if your game is physics heavy, this can be a major performance hog. You'll need to limit the time the game spends on physics.

From the stats you've given, it seems that you have not designed this game with the performance limitations of Android devices in mind. Unfortunately, it may not be possible for you to make some small tweaks to get it working correctly; you may have to make some substantial changes to get it running at a good speed.

Comment
Add comment · Show 5 · 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 DFiable · Aug 23, 2011 at 02:49 AM 0
Share

Thank you very much! That all good advice. I reduced my polygon count(Tris - value) down and it made all the difference. I also used the trim plane on my camera which reduced the draw cells down to 70 and it works great. Thanx again!

avatar image vxssmatty · Aug 23, 2011 at 03:12 AM 0
Share

Its good you've got it working as desired. Though it's a band aid fix.

You should look at the mobile optimization guide, and go through its recommendations..

Things such as using the 3 lights, and your shader use, you might be using more than one pixel light which in mobile = death!

Fixing things such as that, may allow you to not reduce your clipping planes and reduce your own model poly counts (which you'll be surprized as to how many tri's android and iOS can compute.

http://www.unifycommunity.com/wiki/index.php?title=General_Performance_Tips - it is general, but is relevant

avatar image DFiable · Aug 27, 2011 at 01:05 AM 0
Share

Thanks for your help.

avatar image Sisso · Dec 07, 2012 at 10:49 PM 0
Share

DFiable, please, accept the answer.

avatar image raptorkwok · Apr 15, 2014 at 09:44 AM 0
Share

Also, reduce Far Clipping Plane of the camera.

avatar image
0

Answer by Vollmondum · Aug 30, 2013 at 04:39 AM

Maybe you want your game installed on the internal phone's memory. Some SD cards are slow.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Game speed slows down as FPS slows down (on android, only after unity3.4) 1 Answer

moving thousands of objects is very slow, Draw calls 2 Answers

Reference for Target API and Target iOS mobile? 0 Answers

Unity game started running slow 3 Answers

Android touch latency vs. audio playback 0 Answers


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