Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Profiling and Optimizations

Discussion in '2D' started by Matt-K, Mar 12, 2019.

  1. Matt-K

    Matt-K

    Joined:
    Sep 10, 2018
    Posts:
    79
    Hey there,

    I've been turning stuff off and on fixing image sizes and trying to sort of be vert conscious. However, I'm overwhelmed by a lot of the data being generated by the profiler. I'm building an iPhone game 2D and using physics -- I turned off everything in my scene except for the Player sprite and the UI. My CPU % is like baseline 35% and as high as 55% with EVERYTHING except the Player and UI OFF.

    With everything on, all my art work etc... The CPU % is roughly the same. I'm so so so confused by this.

    IMG_2431.PNG
    Here's the full scene.

    IMG_2432.PNG
    This is what I just ran to check if the % would drop.

    Screen Shot 2019-03-12 at 1.13.08 PM.png
    Screen Shot 2019-03-12 at 1.08.32 PM.png
    The CPU is saying 33 ms. Lol.
    I'm just flat out confused by this. It's also fair to say, I'm new to profiling and there's a lot to learn. I also hate XCode it won't let me run instruments, I've never been able to get it to work.
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi @Pudgy138

    Well I'm not an expert of profiling at all, but think about it;

    There is the whole engine running and constantly ticking your MonoBehaviours in your game loop, preparing and rendering frames, processing physics frames, and doing whatever else the engine is doing when it is running.

    Your game isn't probably that taxing even when you add more sprites, it might be close to what you see with nearly blank scene. So I guess you are seeing roughly what the engine takes from CPU/GPU when it is running.
     
  3. Matt-K

    Matt-K

    Joined:
    Sep 10, 2018
    Posts:
    79
    Hello @eses thanks for replying!

    So, what's the best method of getting a clean reading without the engine?? I was profiling this in Xcode by the way. I know there's editor overhead but do you think I am getting false reading from Unity even in Xcode? I was linked to Unity through Xcode while profiling but I didn't think there would be overhead that way!
     
  4. Matt-K

    Matt-K

    Joined:
    Sep 10, 2018
    Posts:
    79
    Screen Shot 2019-03-12 at 3.27.58 PM.png Okay so, I just did some more thorough digging. Here's screenshots from the scene I froze it on to do a GPU frame debug in Xcode. I have screenshots from Unity's profiler which was running simultaneously.
    IMG_2435.PNG
    This is the scene.

    Screen Shot 2019-03-12 at 3.32.57 PM.png Screen Shot 2019-03-12 at 3.35.58 PM.png Screen Shot 2019-03-12 at 3.46.50 PM.png