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 mwozniak93 · Sep 30, 2015 at 01:19 PM · performancespritesprofilerdebugandorid

Lags during tests on mobile SpriteRenderer.RenderSingle

Hello! I am testing my 2D game on mobile. On Android LG2 mini I get very good results, but on Android Lg e430 (it's older phone but still - 512 mb RAM, 1.0 Ghz CPU) I get lags and FPS go down from 30 to 12-20. They are back to 30 after a while, but it shouldnt happen.

In profiler when I have my phone connected I see that SpriteRenderer.RenderSingle is abou 15 % and SpriteRenderer.RenderBatch is 5-20%.

I have one GameObject with SpriteRenderer and simple animation attached to it on the Scene + Background. Sprites are singleSprites and set them to Compressed 256/256 (I lose quality but I wanted to be sure what causing a lag...) I suspect that I did something wrong with Sprites... ;)

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
0

Answer by Ozan_2 · Sep 30, 2015 at 02:03 PM

Hi @kunmateo1993

Unity tries to force maximum resolution on builds. However, mobile devices have little screens so there is no need to force game to run HD or Full HD. Try to add one of your scripts' Start method this line:

 Screen.SetResolution(480 , 600 , true);

You can change resolution values if you are not comfortable with these ones.

You can also set resolution dynamically by getting devices hardware properties (Like if ram is below some value, set resolution that value)

I hope it helps.

Comment
Add comment · Show 4 · 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 mwozniak93 · Sep 30, 2015 at 03:33 PM 0
Share

alt text

I set the screenResolution as you said. Unfortunetly still getting lags. I know that profiler consumes a little bit of fps but still it doesnt look good. And feel also no good... (as far as lags are really noticable)

Here is another test- I only changed Camera from skybox to depth...

alt text

profiler.png (216.0 kB)
profiler.png (292.4 kB)
avatar image Ozan_2 mwozniak93 · Oct 01, 2015 at 09:23 AM 0
Share

@kunmateo1993 , did you try creating an empty project and build it for your phone? On the first screen shot, everything seems okay to me. $$anonymous$$aybe it is the phone itself cannot handle the application. If an empty project causes that kind of lag, there is no need to put an efford to optimize your game.

If the empty project works well on your phone, you should check out build logs. Build log is a really big file. You don't need to exa$$anonymous$$e all the file. Just find that line "Used Assets , sorted by uncompressed size:" Above that line, there are usefull stuff like how much ram is used by each mesh, animation, textures etc. I don't know if this is the solution but definelty it will help

avatar image mwozniak93 Ozan_2 · Oct 01, 2015 at 11:30 AM 0
Share

Yep, I have just made a completly new project. Textures weight was 250 kb. On the scene I had one single sprite which could move with simple analog on touch.

Even when it wasn't moving it created lags. I also installed on the same phone two other games made with unity. Same thing - lags, aspecially at the begining of gameplay.

I guess LG E430 just has too weak hardware and that's it. It's a shame that I wasted 1,5 day for searching a lag-cause-ghost, but at least it wasn't 1,5 week ;) Thanks.

Show more comments
avatar image
0

Answer by outasync · Oct 02, 2015 at 07:06 AM

@kunmateo1993

I have found that doing the following corrected lag issues I was having with Android devices:

Under Project Settings - Quality, make sure the profile being used for Android (Item highlighted in green) have V Sync - Every V Blank. For a simple 2D game you can use the Simple profile, by default Fast, Fastest and Simple have V sync to Don't Sync...which in my opinion for Android devices is wrong.

Under Project Settings - Player, make sure you have Android tab selected, go to Other Settings, Uncheck Auto Graphics API, and make sure only OpenGLES2 is added

Also make sure all your sprites are prefabed, more so if you use them more than once in your scene

Comment
Add comment · Show 3 · 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 mwozniak93 · Oct 02, 2015 at 08:10 AM 0
Share

I did what you said, I still get lags.

I downlaoded 3 other games made with Unity and they work in the same way on my poor device (LG E430) So I do not know how much of improvement your sugesstion gives

avatar image outasync · Oct 02, 2015 at 09:23 AM 0
Share

In that case I would suspect like you the device is just not up to the task. I have 2 new devices and since Unity 5 I experienced lag, I made huge optimizations to my game and it now runs a constant 60fps, I had hoped this was the case for you. Good luck with your project.

avatar image mwozniak93 outasync · Oct 02, 2015 at 10:07 AM 0
Share

Thanks, if we talk about performance issues etc, I have one more case :

I am actually creating another project at home and when I go to the area where is more terrain and some sprites like trees, grass (2d Project also- platformer) my FPS goes down to 26/27. When I exit this area and go to the area where is less terrain ( I use Ferr2D Terrain Editor), actually you can see only a sky and some little ground I get 34-36 fps.

It is stange because I didnt set Application framerate to 30 or anything like that.

Before upgrading unity to 5.2 (when I was using 5.0.1) I got 57-60 fps. I will try use things you mentioned about qualitty settings etc, but do you know if unity autodetects mobile and doesn't allow to get more fps? On PC I had 55-60 fps.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

In depth profiling? 1 Answer

performance issue on android devices unity 2018.1.1f1 0 Answers

Total memory allocated increases indefinately from .80GB untill crash 3 Answers

Profiler: Crowdmanager.update? 1 Answer

UI Text Optimization? Updating Geometry seems to be slow 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