Search Unity

Bug Performance issue due to duplicated frames in Android/iOS Build but not in Editor?

Discussion in 'UGUI & TextMesh Pro' started by odysoftware, Feb 18, 2022.

  1. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    Taken from my bug report... since I did not get an answer yet (report is several weeks old) maybe someone of you has an idea why this is happening...

    When switching to Unity 2021+ (from older 2019) I found out that the performance in Android did drop a lot - so I was investigatig what could be the culprint and I found a very strange behavior where I hope you can fix or explain it? My game is an online TCG/RPG heavily using the UI - so I have now created a very small test project just to show the issue.

    The test project shows a simple Empty Unity 2D (Built-in pipeline) scene with a UI text and an UI imagine on a canvas (Mode: Screen Space - Camera). When you run this scene you will have 2 batches with those 2 objects - as you would expect (see screenshot editor.png - it shows the 2x Draw Mesh in Frame Debugger).

    When now building this to either an Android device or an iOS device and running the attached frame debugger again - you will see that the batches suddenly have doubled (see screenshot android.png 4x Draw Mesh) - each object is now rendered twice?

    This doubling surely cost A LOT of performance as you normally have a lot more batches (15-50 in my case) - and I tried everything to remove this double rendering to no avail. I can change to Canvas mode Screen Space - Overlay, then this is not happening anymore, but I require Screen Space - Camera in my project. So it looks like that in Screen Space Camera is always doubles the rendering (maybe due to shadows (?) - even though everything is disabled...) - which really makes no sense to me. Also why is it only doing this on deployed mobile device and not in editor - which is showing everything correctly - so there seems to be something wrong.

    Any ideas?
     

    Attached Files:

  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    So you know, 2D is not UI. They are also developed by different teams. The correct and dedicated forum for UI is here.

    I can, of course, move your post there if you wish.
     
  3. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    Yeah true - but when using Screen Space Camera - it is somewhat also 2D - because I mix those 2 together, for particle effects I have mesh in front, but still you are right, maybe it fits better in the UI section .

    Not sure where the "true" problem lies though :)
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    That's not my point. I mean it's not part of the 2D feature set which is what Unity means by 2D and what the 2D forum is for. We also don't deal with 2D audio either etc. It's UI, plain and simple. :)

    I'll move your post for you though. Hope you get the help you need.
     
  5. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    Perfect, then thanks for moving
     
  6. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    If this is not a bug in frame debugger, then I would think this is a really severe issue, since it unnecessarily drops mobile performance. It would be great to get at least a clarification on why this is happening or if there is something we can do to prevent it from happening. Especially since it's not a "specific" situation and can easily be reproduced with any latest version and above setup?