Search Unity

A huge performance issue on android with CanvasGroups

Discussion in 'UGUI & TextMesh Pro' started by amit1532, Sep 20, 2015.

  1. amit1532

    amit1532

    Joined:
    Jul 19, 2010
    Posts:
    305
    Hello,
    I have a lot of windows implemented using uGUI with CanvasGroup attached to every window root game object.

    On every given time, a single window is shown, it means that every other CanvasGroup alpha is set to 0.
    I tested the app on my android device (LG G3) and im getting less than 10 FPS.
    The funny thing is that on IPhone i get 60 FPS..

    I tried deactivating the game objects that arnt shown and seeing if that helps and i get 60 FPS on android again.
    I thought that when CanvasGroup.alpha is 0, unity will stop rendering the UI elements...
    I think that this is a bug because it happens only for Android and not IPhone, i tested it on other android devices and got the same results.

    Am I doing something wrong? or should i fill a bug report?
     
  2. DalerHakimov

    DalerHakimov

    Joined:
    Mar 14, 2014
    Posts:
    302
    so, when you disabled the UI elements, did the FPS get back to its normal?
     
  3. amit1532

    amit1532

    Joined:
    Jul 19, 2010
    Posts:
    305
    Exactly
     
  4. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    CanvasGroup.alpha=0 still produces draw calls... So no way to do it. I wrote a scripth that disables canvas when it is out of frustum. You should also do it. I wonder @Tim C 's solutions here. What you think? When CanvasGroup.alpha=0 it still produces drawcall. Is it a bug?
     
  5. amit1532

    amit1532

    Joined:
    Jul 19, 2010
    Posts:
    305
    Is there a way to disablebthe rendering of that canvas group? I dont want to disable the gameobject because it causes problems with coroutines...

    But still, after all its a hack, there is no reason fo it to work that way
     
  6. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    What I am thinking is that there is a new component called 2d mask which uses new cull api in 5.2. Maybe you can attach it to your parent canvas. Than, whenever your windows are outside of this canvas, they are culled(not rendered). But they should be outside of this mask.
     
  7. amit1532

    amit1532

    Joined:
    Jul 19, 2010
    Posts:
    305
    Are you sure it works that way? And im waiting for someone from unity to reply to know for sure if its a bug.. Because why on iphone im getting good performance and not on android?
     
  8. amit1532

    amit1532

    Joined:
    Jul 19, 2010
    Posts:
    305
    Anyone? Its very important because the company i worked for wants to publish the game...
    Sent a bug report: 729093
     
    MrEsquire likes this.
  9. amit1532

    amit1532

    Joined:
    Jul 19, 2010
    Posts:
    305
    I have managed to get fix this issue by adding a canvas component into every gameobject with a canvasgroup attached to it..

    And setting the canvas to enabled / disabled when the CanvasGroup alpha is 0 or 1.
    Its a hack, and i dont think it should be done that way....
     
    awetos likes this.