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 /
  • Help Room /
avatar image
0
Question by Insality · Apr 11, 2016 at 10:16 AM · androidoptimizationlaggytoolkit

Android Laggy Sometimes

Hello there! I have a little problem. I making a runner-like game, where there is a lot of obstacles and they are moving on player. Sometimes, there is a little bit of freeze: obstacles seems moving rougly on a one frame per ~0.3 second;

Im trying a lot of things, to remove that, but unhappy. In the profiler, there is performance pick on Camera.Render.TransparentGeometry and nothing more. Im using Toolkit2d, compression ETC. Moving the obstacles by modify localPosition Also have noticed, when logging android deltaTime, that sometimes it huge different from usual (usual deltaTime 0.016, and sometimes its goes to ~0.02, 0.03)

I have no idea what I can check and update to make gameplay idealy smoothed. Can you help me with some ideas?

Edit: I have checked some other devices. This lags only on my device, and a little bit of this lags on some other. The most devices have no lags Why it can be? My main test device is OnePlusOne, should be a very good and with no lags...

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by fishbrainz · Apr 11, 2016 at 01:41 PM

Check to see if you have a rigidbody2d on your moving gameobjects that have a collider of any kind. Gameobjects that only have a collider on them with no rigidbody are considered Static Colliders and thus should never be moved infoLink.

Also when moving an object with a rigidbody attached either use its velocity property to move it, or if you still want to move it via its transform try transform.Translate(), and compare performance results.

Another lag source for your problem could be the instantiation of objects. Unity's OnEnable() methods are pretty costly when run the first time on an instantiated object, it requiring to draw the graphic, and initializing any other components attached. So most initializations should be done on game launch when you have a bunch of down time to work with.

Are you using any object pooling solution? If no i would highly recommend you look it up and try it. A good pooling solution i found for unity is PoolBoss. A great number of Instantiations could create more objects in your scene than your GPU can handle to draw at once, and so creating a lag spike.

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 Insality · Apr 11, 2016 at 02:07 PM 0
Share

Thanks you for your answer! I will check you checklist and give some response later here ;) All my moving object have BoxCollider and no rigidbody Im using my own pool-solution. I comparing with PoolBoss on my project and they are equal on performance

Some questions: Later im tried to make colliders Statiс (so its seems bad solutions, they should not be moved) and im tried to give them all rigidbody (I forget the result, and i will make it again) it is require a lot of CPU, isnt? I mean for rigidbody for every objects with colliders

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

74 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 2D build for android, memory issue. Sprite import? 0 Answers

Android 2D platformer, low fps 1 Answer

Slow build time for Android (2017.3) 0 Answers

Frame Debug optimisation: A submesh has more than 300 vertices 1 Answer

Draw Calls are still HIGH? 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