Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Game is getting slower after each play

Discussion in 'General Discussion' started by JA_555, Apr 24, 2015.

  1. JA_555

    JA_555

    Joined:
    Jul 10, 2014
    Posts:
    27
    Hello, it seems like after each playthrough, the game gets slower after each play. I thought it was an issue with cache, http://blogs.unity3d.com/2012/10/26/in-depth-cache-server/ http://docs.unity3d.com/Manual/Preferences.html but I don't think that's the issue.

    The solution is just to restart unity (but after a few plays, it goes back down to 20-30fps). My problem is, will this happen on an actual build, where after each playthrough, the game gets slower and slower?

    Note: I felt more like forums because I want people to discuss if they experienced anything like this before.
     
  2. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Export and try? Takes like what 10-15minutes?
    But i highly doubt that would happen in an actual build since, as you said, when you restart unity it's working again.

    Other than that, can't say i have experienced something like this yet.
     
  3. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,986
    Sounds like a memory leak. Have you checked the profiler? Does it happen only on that game, or all your projects?
     
  4. JA_555

    JA_555

    Joined:
    Jul 10, 2014
    Posts:
    27
    I haven't tried on other projects, but it does happen in all scenes though.
     
  5. JA_555

    JA_555

    Joined:
    Jul 10, 2014
    Posts:
    27
    http://answers.unity3d.com/questions/791464/toolstechniques-to-find-memory-leak-roots-in-unity.html
    http://forum.unity3d.com/threads/warning-memory-leak.153450/
    http://wiki.unity3d.com/index.php/DetectLeaks

    After reading these, it does sound like a memory leak (thanks zombiegorilla). I found a wiki page that shows me how to find the assets that are causing trouble.

    However, I didn't really find anything that tells me what to do after. Is it as simple as just not reference these assets in my script?
     
  6. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,986
    One common cause is creating objects and destroying or reusing them. Not sure what your game is, but are spawning things regularly, like bullets/missles/fx, or things of that nature? If that is something your game does, and if turns out to be part of the problem, pooling is good way to close that hole. You can use the profiler to root out the problem as well. Watch your game for a while, as it starts to slow down, you should see something in the profiler increase, that should help narrow it down.
     
  7. JA_555

    JA_555

    Joined:
    Jul 10, 2014
    Posts:
    27
    Yes exactly, I'm using missiles and fx. I'll look into pooling. Thank you