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. Dismiss Notice

Game slows down after a while

Discussion in 'Android' started by ckrin, Apr 7, 2014.

  1. ckrin

    ckrin

    Joined:
    Oct 8, 2013
    Posts:
    36
    hey,

    as the title says, my current game project for android slows down after a while. the problem occurs after 5 to 15 minutes.
    its an endless runner, but i did everything concerning optimization that i could think of. (small res. atlastextures, i make use of physic matrix, less use of instantiate,...)
    for first few minutes it runs with const. 60fps. then it starts to jump between 20-60fps. restarting the game doesnt fix the problem. only way to get rid of the laggs is to wait a another few minutes....:confused:

    my problem feels like memory is overloaded or something but i only do instantiate things once, and then move them in the scene while the game is running. i was told this is the best approach for that.

    did one of you ever had the same problems?:confused:
     
    Last edited: Apr 7, 2014
  2. nindim

    nindim

    Joined:
    Jan 22, 2013
    Posts:
    130
    Best thing to do here would be to run the profiler to see what it causing the slowdown. Also best to run it on device (if a mobile project), as the editor isn't representative.

    Are you manipulating any materials at runtime? Accessing render.material will cause it to get cloned, doing this a lot can cause performance issues (I mention this because it happened to me).
     
  3. ckrin

    ckrin

    Joined:
    Oct 8, 2013
    Posts:
    36
    editor runs perfect. problems only occurs on mobile device. and YES, there is a water shader i didnt mention, that scrolls the water texture (its from the firstfantasy assetpack). i asked for help in their support section too, because the texture starts pixelating after a while. maybe these problems belong together.

    i only got student pro licence and i currently unregistred it, because of the branding in the export :/ will activate it later to check for issues and post the screenshots. thanks so far!
     
  4. PartyD0nut

    PartyD0nut

    Joined:
    Mar 24, 2014
    Posts:
    17
    Install a temperature monitor on your phone. The fact that it goes away not by closing the app but by waiting (cooling down) a few minutes. What phone are you testing this on? Whats likely happening is your phone cpu is getting to hot, this in turn makes the device underclock giving you varying performance.
     
  5. johnnydj

    johnnydj

    Joined:
    Apr 20, 2012
    Posts:
    211
    since you mentioned it's an endless runner:
    are you constantly destroying objects that are already out of your view.
    like are you destroying stuff that you already ran through?
     
  6. Nitrohex

    Nitrohex

    Joined:
    Jan 16, 2013
    Posts:
    58
    If you mean Object Pooling, then you need to make tradeoff on how many object you are pooling vs how many objects you need in a particular time of the game.

    Mike has a excellent explanation of this here: http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/object-pooling
     
  7. ritesh_khokhani

    ritesh_khokhani

    Joined:
    Jun 26, 2013
    Posts:
    47
    i thing you are not destroying all unused assets or assets which are used before,
    destroy all the objects when it is not in use,

    it would boost performance for sure,

    also take help of unity profiler it will let you know when it stucks!
     
  8. ckrin

    ckrin

    Joined:
    Oct 8, 2013
    Posts:
    36
    thanks for your answers! i did not reply, cause im still testing around.
    ill keep you updated.