Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Laurence_B · Jul 07, 2018 at 08:00 PM · android3dframerateframerate drops

Fast frame rate drops

Hey! I have programmed a game for Android. The frame rate drops from 60 to 30 really quickly and back up again, resulting in a lagging game. I have set Application.targetFrameRate = 60; but that still doesn't work. Sometimes I have a constant 60 but only for a few seconds and then it starts dropping again. Any ideas? Maybe any certain commands or stuff in my scripts which could cause it?

Comment
Add comment · Show 4
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 dan_wipf · Jul 07, 2018 at 08:14 PM 0
Share

in a empty scene?

avatar image Laurence_B dan_wipf · Jul 07, 2018 at 08:18 PM 0
Share

nope. a finish 3d game. Not using any complex 3d models though

avatar image imM4TT Laurence_B · Jul 07, 2018 at 10:15 PM 0
Share

$$anonymous$$aybe you can turn down your fixed Timespet if it is not already done
(Ofc it will make your game lower with physic calculations)

Show more comments

2 Replies

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

Answer by Tobychappell · Jul 08, 2018 at 10:34 AM

For loops dont necessarily slow the game down, its what happening inside them that does. Try commenting out all the code in the for loop and see the performance difference.


Dont take stabs in the dark regarding performance issues.

Use the Profiler and see what is happening on the CPU.

Look at what the scripts are doing and what the Garbage Collector is doing. Im not an expert on Garbage Collection but what i do know is periodically (possibly when a threshold is passed) the GC will free up memory that your game is using but no longer has access to it, e. g local variables in a method. The GC will block the main thread so it can do its thing, which is what causes most lagg issues.

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 Laurence_B · Jul 08, 2018 at 10:46 AM 0
Share

Good point! I found out that VSync is causing big frame drops

avatar image Tobychappell Laurence_B · Jul 08, 2018 at 10:52 AM 0
Share

hmmm, do you have Vsync on? vsync needs to be off if you want to set the target frame rate.

https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html

avatar image Laurence_B Tobychappell · Jul 08, 2018 at 11:45 AM 0
Share

Turning off Vsync and then setting the target frame rate was a massive help. I am not getting any massive frame rate drops, just from 40 to 45 now. I will look for even more ways to improve performance. But for now, I think you had the answer! thanks

avatar image
1

Answer by seandolan · Jul 08, 2018 at 03:22 AM

It sounds like you have some script/behaviour that is taking a little bit more processing power to calculate so the game is getting held up slightly before processing the next frame. Make sure you check and loops (for or foreach, etc) that is happening in any Update() or repeating functions. Loops greater than say about 100 with lots of actions can slow things down. If it's an essential process doing it, maybe look at options to do it in chunks. If you have a for loop that goes thru 1000 times, do it in lots of 100s - just an example. Would need to see the code to help out more. Hope this helps mate.

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 Laurence_B · Jul 08, 2018 at 09:38 AM 0
Share

Thanks, I rewrote all of the update functions (2 or 3), where there were loops. Except in the menu, where I use for loops because of all the clickable objects, but they get disabled anyway once the game starts. It definitely helped because there is more time between each frame drop now! Something else must be causing it though.

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

209 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 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 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

Huge fps drop after using the Status Bar or Volume Controls on Android 0 Answers

Default Frame Rate for Mobile Device 0 Answers

Interstitial ad kills framerate in different scene. 0 Answers

My 3D object in Vuforia AR is glitching and not rendering properly 0 Answers

How to change framerate for Android? 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