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
1
Question by UnityProgrammer5 · Nov 02, 2015 at 10:16 PM · androiduiprofilerkindle fire

Android - Inexplicable Lag

Hello!

I am experiencing massive lag when testing on Android devices. Here is an image of what the Active Profiler is displaying: alt text

Obviously, the lag shown here is caused by the Blur Optimized image effect. When I disable the effect, fps returns to about 30. I would like to use the effect, but this behavior is far worse than what is preferred.

Additionally. when more active UI is present, I notice more lag. In a second test, the only UI object was a Text object. This Text object had text which filled the entire screen of the device. Here is the screenshot of the Active Profiler: alt text

Under 30 fps is rather poor. What am I doing incorrectly? I know Unity is more capable than this. Here are some details on my project to help:

  • In my project, menus are divided into "Manager" scripts. These managers each contain a Canvas Group, and countless UI objects (Text, Button, Image, etc.). There are about 20 such managers, each with 20-100 UI objects. When offscreen, the managers disable themselves (and their UI objects).

  • I am building for the oldest version of Android possible to feature my game on the largest range of devices. If I remember correctly, I am building in 2.3.1

  • I am testing on a Kindle Fire HD. Is HD just slow?

  • In previous tests of previous versions of my game, lag as shown in the first attached image (over 150 ms) was named within the hierarchy as Mesh.SubmitVBO, Mesh.DrawVBO, or SpriteRenderer.RenderBatch.

So just to recap:

  1. Can I somehow use the Blur Optimized Shader?

  2. Why is my game experiencing such lag? It runs 60-120 fps on my computer. Is this normal behavior? How can I correct it?

3.png (209.0 kB)
textlag.png (216.1 kB)
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 UnityProgrammer5 · Nov 10, 2015 at 01:20 AM 0
Share

Here's a picture of the lag experienced in the menus versus in the actual game: alt text

SpriteRenderer.RenderSingle and SpriteRenderer.RenderBatch are still the main culprits. Could the built-in UI Sprite (which I often use) be an issue, as it is not part of the Sprite Packer atlas?

Another picture of lag (notice the jumps between RenderSingle and RenderBatch): alt text

ingameversusmenus.png (241.2 kB)
variousmenuscombined2.png (472.4 kB)
avatar image UnityProgrammer5 · Nov 14, 2015 at 02:31 AM 0
Share

Can somebody please reply? Or at least request more information.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rutter · Nov 02, 2015 at 10:25 PM

Obviously, the lag shown here is caused by the Blur Optimized image effect.

Mobile and PC platforms have vastly different drawing capabilities. You're invoking some effects that require advanced shaders and numerous draw calls, both of which are going to hurt performance on mobile.

If you don't know what that means, the simplest and best advice is to stick to shaders that are specifically mobile-friendly.

You might also check and make sure that you're using deferred rendering, if that's available with your configuration.

I am building for the oldest version of Android possible to feature my game on the largest range of devices. If I remember correctly, I am building in 2.3.1

Sounds reasonable, but it might be worth checking if newer builds

I am testing on a Kindle Fire HD.

Oof. The Kindle Fire is not a very powerful tablet.

In previous tests of previous versions of my game, lag as shown in the first attached image (over 150 ms) was named within the hierarchy as Mesh.SubmitVBO, Mesh.DrawVBO, or SpriteRenderer.RenderBatch.

If you're seeing a lot of heavy SubmitVBO calls, you may be using too much geometry in the scene.

It sounds to me like you're writing checks that the hardware just can't cash. Optimization is a big field of study, so you might want to look for some pointers and tutorials.

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 UnityProgrammer5 · Nov 05, 2015 at 01:06 PM 0
Share

Thanks for the reply!

I created a new build, using the deferred rendering option, and packed most of my UI sprites into the Sprite Packer. I deleted the BlurOptimized component of the main camera. The profiler showed no apparent increase in fps and no decrease in lag.

I think the key issue revolves around the UI. The game itself runs at about 45 fps; the menus often run at under 15 fps. I would expect the game to run faster than the menus.

At some point, I used the code line Screen.SetResolution(400,800, true); adapted from http://answers.unity3d.com/questions/1074232/lags-during-tests-on-mobile-spriterendererrendersi.html. Of course, the resolution was goofed up, but it dramatically improved performance. Here is an image before implementing the code (one of the faster UI menus): alt text

After implementing the code: alt text

That is a dramatic change. Beforehand, $$anonymous$$esh.SubmitVBO required 58.53ms; after, it only needed 0.73ms. The only thing "slowing" down the game for the latter was Graphics.PresentAndSync, which I'm assu$$anonymous$$g just caps fps at 60.

Considering how much this line of code improved performance, what is going on? Is the issue the high-definition $$anonymous$$indle spending too much time on rendering? If so, can I alter the code to prevent the use of HD?

storeoldres.png (225.8 kB)
storenewrestaftertime.png (230.8 kB)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

[UI] Profiler scroll rect 0 Answers

clicking on button while moving on andriod 0 Answers

Why is this raycast still hitting ground below a UI button, even after I pass a check to see if finger is above button (as per Unity tutorial) 1 Answer

Trouble on resize screen and anchor ui in android based version of Space Shooter tutorial 3 Answers

Input Field problem (Unity 4.6 UI) on LG G3 Android device 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