Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

UI Re: UI Drawcall batching broken

Discussion in '5.1 Beta' started by iivo_k, May 22, 2015.

  1. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Sorry to spam, but Alex Lian closed this thread
    http://forum.unity3d.com/threads/ui-drawcall-batching-broken.327527/
    saying
    and I can't figure out a way to send a private message to him.

    Just looking for clarification here, are we only supposed to discuss bugs that don't happen in any other versions in addition to 5.1? I thought it'd be approriate to post it here too, since the bug still plagues 5.1.0f2.
     
    Last edited: May 22, 2015
  2. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Also, the RC phase post says the following:

    Well, this is a critical stopper bug for us, we use the UI in a shop inventory with lots of scrollable items and the draw calls went up from somewhere around 40 to over 500! That means both the latest 4.6 and 5.1 versions are currently unshippable on mobile.
     
    Whippets likes this.
  3. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    Yep, had the same issue. Decided to use NGUI instead which is way better than Unity UI.
     
  4. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    I think this forum section is mainly for issues related to the new features that were added in 5.1

    It would get messy if all issues would be posted here. The thread in Unity UI section should be the best place to post case numbers and such related to this issue.

    Unity UI does however feel a bit abandoned "project" for the past months :(
     
  5. Alex-Lian

    Alex-Lian

    Guest

    Correct, this forum is about feedback, discussion and bugs of 5.1 specific features.

    Bugs that are still present in 5.1 from previous features should stay in their defined forum area, but if it's a higher priority factor please contact the support channel to back up the forums. While we do monitor the forums, when we're heads down coding we tend to stop paying attention. So, the support team tries to address the bugs first before poking us...
     
  6. Alex-Lian

    Alex-Lian

    Guest

    They're still hard at work addressing bugs and improving things. They're trying to get some particular perf improvements in for the 5.2 window, since 5.1 is already wrapping up. Also, life is happening, as there's at least one new baby specifically in the UI team family...
     
    GCatz likes this.
  7. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    281
    Glad to see the UI is being worked at,
    I dream on UI culling..

     
  8. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    With UI culling, I think it would probably be the perfect system since all the other things can be achieved by yourself.
     
  9. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    While I'd love to have built-in UI culling, it is not too hard to write a custom one. I made culling system using a component derived from UI Image that just does not submit any vertices when it is culled. Another script then handles the actual culling and manages the cullable images, informing them whether they should be currently culled away or not.

    EDIT: And obviously there is some memory and performance overhead with this approach, but it works quite well. I for one would welcome our new native UI culling overlords, though.
     
  10. Newcomma

    Newcomma

    Joined:
    Feb 10, 2015
    Posts:
    89
    Hi mh114, would you be willing to share that derived component?
     
  11. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    Oh, that component is trivial: just override the OnFillVBO() method and do nothing if the Image is to be culled. For the actual culling, I did it with RectTransform.GetWorldCorners() for both the cull area and the cullable items. :)
     
  12. Newcomma

    Newcomma

    Joined:
    Feb 10, 2015
    Posts:
    89
    Cool thanks for the tip :)
     
  13. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    I recently realesed my game's UI draw call was too high. Then I made a system using mechanim that makes UI disactive when it is out of view frustum. I mean when mechanim executes stateExit I make object disactive. So my drawcalls decreased from 100 to 5.
     
  14. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    Some really awesome tips to reduce the drawcall. Thanks guys!
     
  15. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Can you explain more? is this something anyone can do or project specific
     
  16. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    294
    Probably he means just to disable the GameObject of UI panels/windows once they've animated out of view, which is a good thing to do even if we had built-in culling.
     
  17. HakanOzcan

    HakanOzcan

    Joined:
    May 14, 2013
    Posts:
    40
    I have many windows, popups etc. Transitions between these windows are handled by using mechanim. I have 3 animation types. 1- windows goes from right to center/vice versa 2- left to center/vice versa 3- fade in out. Than I wrote a really simple state machine script and attached it to exit animation state of each animation types.

    Scripth is

    override public void OnStateExit(Animator animator,stateMachineInfo,) //look the detail of state machine behaviour
    {
    animator.gameObject.setActive(false);
    }

    Then , whenever Panel gameobject goes out of viewing frustum,it automatically disable itself. However, before you again want to open this window. First you should activate gameobject. I mean

    animator.gameObject:setActive(true);
    animator.setBool("Open",true);
     
    mh114 likes this.