Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 mrdoktor1974 · Oct 04, 2013 at 12:32 PM · androidcpugcspikes

1-3 second "spikes" (not GC?) on Android

I'm experiencing 1-3 seconds long cpu "spikes" on my Samsung Galaxy Nexus every now and then. It goes from around 45 fps to around 30 fps for 1-3 seconds even while having the game paused with Time.timeScale = 0.00000001f. It's not a single script that runs slower, it's everything from rendering, overhead etc. Also, since the game is paused all the other profiling such as draw calls, audio sources etc are flatlined.

I've made a script that checks if garbage collection is run (on update check if heapSize is less than heapSizeLastFrame) but there's no collection before, during or after the spikes. They seem totally unrelated. Maybe you can't check garbage collection like this?

I have no other apps running on the phone.

Has anyone got any idea what this could be?

Comment
Add comment · Show 11
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 meat5000 ♦ · Oct 04, 2013 at 12:34 PM 0
Share

Need more info. What exactly happens in stats button when this happens. Do you have access to the profiler?

avatar image mrdoktor1974 · Oct 04, 2013 at 12:52 PM 0
Share

I have access to the profiler (connected to the android device). If you mean the stats button I think about it's the editor and the problem is on the android device...

avatar image meat5000 ♦ · Oct 04, 2013 at 12:54 PM 0
Share

So where do the spikes occur according to the profiler?

avatar image mrdoktor1974 · Oct 04, 2013 at 01:05 PM 0
Share

Sorry but what do you mean by where? Every function in the profiler is slowed down, from Render to Overload. So it's no specific function. It comes and goes a bit randomly. I can even happen when the game is paused (timeScale=0.0000001f).

avatar image meat5000 ♦ · Oct 04, 2013 at 01:32 PM 0
Share

In profiler click on the spike and read off what processes are taking the biggest ms to complete.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SilentSin · Oct 04, 2013 at 01:30 PM

If you have the pfiler, we need more info.

If you don't have the profiler, how can you say its not a script that is causing it.

And no, Time.timeScale = 0.00000001f is not paused, why would you think that. Time.timeScale = 0 is paused. And even while paused, I believe everything still gets Update() calls, just with Time.deltaTime as 0 (or in your case, a very very small number). Do some debug logging to verify if this is the case.

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 mrdoktor1974 · Oct 04, 2013 at 01:41 PM 0
Share

I use timeScale=0.000001f to be able to update NGUI panels when pausing the game from the players point of view, not programmatically. And programmatically it means that no new gameobjects are spawned etc.

Like my description says there's not much to read out of the Profiler. In some cases all other profiling is flatlined during the spike (audio sources, draw calls etc).

Almost all functions in the CPU Usage profiling slows down during the spike so there's no telling which one is the "theif". So there is no specific function that stands out.

avatar image SilentSin · Oct 04, 2013 at 01:56 PM 0
Share

I have no clue what you mean by not programatically and programatically. And no, it doesn't mean that no new game objects are spawned, it just means they'll take a really long time to spawn. Is there something wrong with timeScale = 0?

Turn on deep profiling (I think that's what its called). It lets you dig into everything to see exactly what is causing the slowdown.

avatar image mrdoktor1974 · Oct 04, 2013 at 02:15 PM 0
Share

Forget about the timescale. It just needs to be more than 0 for NGUI to update the graphics in the pause menu.

Deep profiling is on and there's still just an overall slowdown.

avatar image SilentSin · Oct 04, 2013 at 02:18 PM 0
Share

Interesting, I would have thought NGUI would support actual pausing, but whatever.

If every single function is taking longer, then its something else on the phone.

  1. Get a task manager and kill every running app immediately before running yours and see what happens.

  2. If that doesn't help, you'll need to test on s different device.

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

19 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

Related Questions

Standard Assets(Mobile) too expensive(CPU)? 0 Answers

Event System and GVR Event System 0 Answers

Profiling empty project, but there is activity! 1 Answer

What is VFP? 1 Answer

Can Apps ask for CPU power? 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