Search Unity

(2018.3.11f) Strange gradual slowdown

Discussion in 'Editor & General Support' started by tetriser016, Mar 31, 2019.

  1. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    So, I just finished the first boss in my current project and I just founded a very strange slowdown in my game during test gameplay.

    Starting in the first stage, everything is smooth and usable, until I reached the third stage, the game gradually slowing down. Even with using Resources.UnloadUnusedAssets didn't work well; it still slowing down no matter what.

    Tried to make a test build, but it's gradually slowing down at the fourth stage. Is it Unity's having a bug or my stages are not optimized enough?

    Just in case, I brought my project source for your further inspections:
    https://drive.google.com/file/d/16gF538UkdKoxQP-1EVj5gk79RoaF-Lwj/view?usp=sharing
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Unity comes with a tool that allows you to measure how expensive something is. This tool is called a "Profiler".

    Profiler overview
    https://docs.unity3d.com/Manual/Profiler.html

    Introduction to the Profiler
    https://unity3d.com/learn/tutorials/topics/interface-essentials/introduction-profiler

    You can measure performance while it's fine and while it's slow. Then you can look at both captures to figure out where the performance decrease occurred.
     
  3. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    Well, I forgot to tell that I've checked before. It seems that it has something to do with the memory usage (Total Allocated), perhaps memory leak?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    If on mobile watch out for thermal throttling. Otherwise just profile. Learn how to use the profiler properly, it's not just bars and graphs.
     
  5. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    I want to know, what else are the factors of slowdown in Unity, besides incompatible hardware and improper memory usage?
     
  6. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    OK, based on what I witness, looks like my audio system was causing the game to slow down, since it suddenly uses too much CPU.
     
    Last edited: Apr 1, 2019