Search Unity

UI performance hit while moving.

Discussion in 'Editor & General Support' started by Russ242, May 26, 2018.

  1. Russ242

    Russ242

    Joined:
    Apr 14, 2013
    Posts:
    7
    Hey,

    I've been trying to increase performance for the project i'm working on and i noticed that the UI seems to hitting performance quite a bit, but only while the character is moving. I found this a bit odd because the UI elements aren't moving or anything.

    In the pic below you can see the UI section increases as I move and significantly increases when I open the inventory and move. When stationary there is no impact at all.

    2018-05-25_23-53-40.png

    Does anyone know if I can reduce this performance hit somehow?

    Thank you.
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    Click on your profiler where that spike happens and look at the code hierarchy to see what takes up the most time per frame. When you highlight a function in the hierarchy, the section of the graph that represents the workload that function puts on the CPU will be highlighted, so you should be able to find the function that creates the bulk of that UI spike by selecting one item at a time until you see a large chunk of the purple section lit.

    If you can share what Unity internal functions are slowing you down, I might be able to help more. If it's not a unity internal function, I still might be able to help if you post the code for that function.

    Good luck!
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    Here are a few resources that should help you to get started with the Unity Profiler and UI optimiztations.

    Learn how to diagnose common performance problems and optimize your projects:
    https://unity3d.com/learn/tutorials/topics/performance-optimization




    Optimizing Unity UI:
    https://unity3d.com/learn/tutorials/s/best-practices
     
    Nicolas1212 likes this.