• 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 UnbreakableOne · Jan 27, 2015 at 08:19 PM · androidprofiler

Need help debugging my lag problem in Android.

Hi,

I'm facing a performance problem that I can't seem to fix.

I have a very simple game that is similar to Fruit Ninja but I instantiate objects at top of the screen and they move downward in a 2D camera and player interacts with them with drag/swipe.

Problem is, FPS is dropping with no indication in Profiler, even when profiling on a device.

I'm using 2D toolkit and not Unity's native 2D and game is fairly simple, how can I determine what causes the lag when there is no indication in the profiler?

I've tested on several phones and tablets with various Android versions and it's better on more high end devices but it still lags even on those devices.

Is there anyway I can track this and find root of it?

Thanks

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 Imtiaj Ahmed · Jan 27, 2015 at 09:07 PM 0
Share

$$anonymous$$aybe your instantiated objects are too heavy (i mean size/type of textures, shaders that are not mobile friendly etc.).

avatar image Simon-Larsen · Jan 27, 2015 at 09:32 PM 0
Share

i guess there could be a lot of reasons for bad performance, but I would try to disable as mamy scripts as possible to see if it's scripting that is causing your trouble. If it is, then you can enable one script at a time to find the scapegoat.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by nstens · Jan 28, 2015 at 08:31 AM

I found that there was two main issues when I encountered problems like this. Colliders are very intensive on Android, simplify everything to Box Colliders if there if there any Mesh or Sphere Colliders. Make sure that any objects in the background are collision free.

A second thing I found out was the Instantiate and Destroy methods are quite intensive as well, after a bit of research I found out about Object Pooling. It basically means reusing any objects by just altering their properties to make it look like they are new ones.

So in your Fruit Ninja type game, you might only have 10-20 objects, and whenever one of them is hit it will move back to the initial position and change to another mesh.

This is Unity's tutorial on it, it might explain it better than I did. http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/object-pooling

I hope that all makes sense and it helps a little.

Comment
Add comment · Show 1 · 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 UnbreakableOne · Jan 28, 2015 at 12:16 PM 0
Share

Thanks for the reply.

Re your suggestions:

1) I have like 8 colliders at most in the game, so they should not be a problem.

2) I do aware of pooling but there is no CPU spike in profiler and also I have this lag in the very beginning of the game.

Thanks

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

22 People are following this question.

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

Related Questions

Unity profiler Gfx.WaitForPresentOnGfxThread 2 Answers

Android lag on Nexus 7 (2012) 0 Answers

Unable to connect Profiler to Android 5 Answers

Profiler says that game is running at 10ms(100FPS) but on mobile runs at 45FPS. 2 Answers

Unity 2019.3 LWRP strange Performance Issue on android 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