Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Any tips on how to fix lag?

Discussion in 'General Graphics' started by svenvanh, Oct 29, 2020.

  1. svenvanh

    svenvanh

    Joined:
    Nov 29, 2019
    Posts:
    51
    So I'm working on a small mobile game where you have to mow all the grass.


    when I play on mobile the performance aren't that good (profiler says around 15/20 fps)
    this is because of all the grass of course. 1 "square" of grass contains 14 grass objects all with a box collider (and Mesh Renderer etc). But my question is how can I get the same result (when the mower touches the grass it disappears) but with better performance? I've already disabled the shadows in the mesh colliders (cast shadows, receive shadows) but I'm not sure what to do else. Anyone got some ideas pls let me know!

    some more info:
    Unity 2020.1.2f1 3D

    photo of the grass object: upload_2020-10-30_0-20-16.png
     
  2. Madgvox

    Madgvox

    Joined:
    Apr 13, 2014
    Posts:
    1,316
    Have you profiled your game on the device to confirm that it is the rendering of the grass that is taking up the time?
     
  3. svenvanh

    svenvanh

    Joined:
    Nov 29, 2019
    Posts:
    51
    Hi Madgvox,

    I have run the profiler again the one that seems to take the most "performance" is Semaphore.WaitForSignal
    it takes about 90% of the 100%. any idea what this could be? (the picture is taken on a peak tho)
    upload_2020-10-30_9-10-4.png

    When I'm not on a peak the game has around 25/30 fps. the most % is then at BatchRenderer.Flush (contains all of the grass fields) upload_2020-10-30_9-14-8.png

    Please let me know if you have any tips/ideas on how to make the performance better! Thanks!
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,406
    Semaphore.WaitForSignal means the time is spend on another thread. The parent sample usually is a good indicator of where to look, in this case GfxThread means Render Thread.
    Check out Timeline view and consult the profiler documentation which contains a list of such common samples, that should help you get a first handle on what is going on.