Search Unity

[Question to Testers that work on Mobile] Performance?

Discussion in 'UGUI & TextMesh Pro' started by AgusB, Aug 22, 2014.

  1. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
    Hi, I'm not using Unity 4.6 cause I don't like to develop on a Beta Release, but I'm really looking forward to the new UI.
    Does any tester here tried the UI in a mobile device (specially android)?
    How does it perform?
    Is it fast? smooth?
    Can you compare it with NGUI and the previous Unity GUI?

    Thanks a lot
     
  2. Muttley72

    Muttley72

    Joined:
    Aug 22, 2014
    Posts:
    8
    I've just went through a very quick test of the new UI in my project in which I'm using NGUI, I didn't compile the results and tested on mobile but the first thing I noticed in the editor is about draw calls: I have three type of elements on the UI (text, button and scrollbar) and while NGUI renders them with only 1 draw call, Unity GUI takes 4, 1 for text, 1 for button and 2 for the scrollbar. Three draw calls more for my racing game on mobile is a lot, I've tried so far to squeeze every draw call out of the geometry and materials and so I'm a little worried about that. If someone is aware of a way to reduce the new UI draw calls count please tell me,

    Thanks
     
  3. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Not...really. It's worse than one, but I can't think of any scenario in which 3 draw calls could be considered "a lot", unless this is being multiplied several times per frame. (If you have a bunch of uGUI's in world mode, for example, this might be an issue on mobile). These are also most likely pretty cheap draw calls; there's no lighting, no normal maps, and the meshes the GUI system uses are rarely more than quads.
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    I can't compare performance directly with NGUI, but as for comparison with the previous Unity GUI (as in, OnGUI), it is much faster. Even 2 or 3 buttons (my debug outputs) in the old GUI slowed down the game more than my entire UI does now. Granted, a lot of that is overhead, but it's still dramatically better regardless.
     
  5. Muttley72

    Muttley72

    Joined:
    Aug 22, 2014
    Posts:
    8
    Definitely better, no doubt. Your logic about the draw calls makes sense, but I'm eager to compile on mobile and test the performances differences on an iPhone4, I'll let you know.
     
  6. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Depends on what hardware you are targeting, but if we are talking more modern iOS devices (all above iPhone 3gs. etc.) I would say that a few extra drawcalls for a UI is pretty much a non-issue. Sure, you do want to keep them down but going from 1->3 or 4 should not be a major problem.
     
  7. Muttley72

    Muttley72

    Joined:
    Aug 22, 2014
    Posts:
    8
    All right, I migrated in test my main interface from NGUI towards uGUI and tested it on mobile with a heavy stressed version of the game were everything can make the difference: with iPhone4 the result is quite good, the game runs fast enough, I just have to say at first sight during gameplay the version with NGUI is a little bit more performant in terms of frame rate (in Xcode is quite similar). I also collected several data from Xcode internal profiler and I'm going to analyze them in order to highlight the average difference, but I have to say I'm happy of the result, obviously I would be happier with 1 draw call only.
     
  8. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
    Great!
    In one of my android games, the main menu, which is just NGUI and nothing else takes too long to load, the music starts playing before anything is visible. This delay depends on the speed of the phone but it's noticeable anyways. Do you think uGUI loads faster? Maybe NGUI needs to load certain assets and resources to work first and that's why it takes long to load for the first time.
     
  9. Muttley72

    Muttley72

    Joined:
    Aug 22, 2014
    Posts:
    8
    Loading scene speed is something I didn't measure, but I will. In any case I think you could solve your problem using a coroutine to introduce a fix delay or yielding the execution of the music until the menu is shown
     
  10. BeforeTheLight

    BeforeTheLight

    Joined:
    Jan 7, 2011
    Posts:
    168
    How are you getting everything down to 3 draw calls?
    I have a game I am working on that was NGUI and was 1 draw call for all UI. Now uGUI has me running at 19 draw calls. I can see 2 or 3 but 1 to 19 is a big jump.
    Can you atlas in uGUI like in NGUI?
    I have read the docs and watched the videos and my understanding was unity would batch elements together(Atlas) to reduce draw calls however I am not seeing the results. Please correct me if I am doing something wrong and point me to the docs to reduce these draw calls if they exist.

    Thanks
     
    Last edited: Aug 28, 2014
  11. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
  12. BeforeTheLight

    BeforeTheLight

    Joined:
    Jan 7, 2011
    Posts:
    168
    Excellent thought Tim. I have never used unity's 2d workflow so did not know about this. I am not at the office right now but if it's disabled by default I bet this is the issue.

    Thanks
     
  13. BeforeTheLight

    BeforeTheLight

    Joined:
    Jan 7, 2011
    Posts:
    168
    I have enable the Sprite Packer in editor settings to Always Enabled and do not see any change still 19 UI draw calls. All my elements have the same Packing Tag. I tried to go to window->Sprite Packer as the documentation says but it is greyed out. I started a new project without importing anything and still no sprite packer window. I imported a few sprites and gave them the same Packing Tag, made a few UI elements and got 2 draw calls, and the Sprite Packer window was still greyed out. I am still on build 17 for right now.

    Is this a pro only feature?
     
  14. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    It is.
     
  15. BeforeTheLight

    BeforeTheLight

    Joined:
    Jan 7, 2011
    Posts:
    168
    My apologies for wasting everyones time. Thanks!