Search Unity

Mobile performance

Discussion in 'General Discussion' started by RyanScotfield, Jul 20, 2018.

  1. RyanScotfield

    RyanScotfield

    Joined:
    Jul 20, 2018
    Posts:
    4
    Hello, I have some doubts about what would be a mobile game with a good performance, currently looking at the profiler of my project, the performance of the scripts stays at 1000 fps (despite some peaks of frames).
    So here are the questions:

    What would be the interesting performance of staying in the scripts?

    What performance can be harmful to the gameplay?

    And finally, is there a healthy memory allocation that does not cause frame drop problems? and if so, what
    would it be? for example 1mb.
     

    Attached Files:

  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,183
    Are you profiling within the editor? Or within a build?
     
    Peter77 likes this.
  3. RyanScotfield

    RyanScotfield

    Joined:
    Jul 20, 2018
    Posts:
    4
    in the editor, I think.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    What?
    Bad performance?

    Don't profile in the editor. Do a build on a mobile device, profile there. You should be aiming for stable 60fps, but if that's not feasible, at least 30fps. Profiling in the editor doesn't really help much.
     
    JamesArndt and Peter77 like this.
  5. RyanScotfield

    RyanScotfield

    Joined:
    Jul 20, 2018
    Posts:
    4
    Thank you for your help, I will check as soon as possible to measure the performance on the device.
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618


     
    RyanScotfield likes this.
  7. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    You can use the Android Studio profiler when the build is running on the device. The editor isn't going to help you test real-world performance on the device. I can give you some tips to help keep performance good. Use batching (objects share materials and combined meshes), keep draw calls reasonable and always keep an eye on your fill rate / overdraw (drawing transparency over transparency or over large areas of the mobile device screen). This fill rate stuff is probably the number one killer of performance on mobile devices. Keep an eye on the complexity of your shaders, don't use real time GI or the Standard shader on mobile. If your 3d meshes don't use mesh collision, you can uncheck "Read/Write" and gain memory (in the FBX importer), you can also use Mesh Compression and set it to Low or Medium (you'll really never see changes to the mesh). Use animation compression if you have longer animations with lots of keyframes. In your code try to cache references to any components you're going to use in constantly updated methods. Also in your coding (if you can) move things like raycast testing into methods that are only triggered under certain conditions, such as a distance value or a radius value...something as simple as using a trigger sphere to tell the object to test raycasts. In simple terms try to minimize the amount of stuff going on in every single frame of your game. Try to avoid deeply nested transform hierarchies, especially in the UI canvas. Traversing these nested hierarchies can cost time if there are a lot of transforms. I'm trying to think of other things I've learned over the years. Another is to bake your world geometry lighting using lightmapping. Use light probes for "real time" lighting on your dynamic objects like the player.
     
    an_n, pixelR, Ryiah and 2 others like this.
  8. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Buy a really crappy Android tablet and get your game running smoothly on there.

    I did that along with an FPS test on the players device across all the graphics settings and tweaked the quality as neccessary.
     
    Ruslank100, pixelR, Amon and 5 others like this.
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,183
  10. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Yep. Good advice. I hope alot of people read this. :)
    Especially, the "buy a crappy android tablet" part.
     
    Ruslank100, Meltdown and JamesArndt like this.