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.

Unity UI [Solved] Unity 2019.2.13f1 - Curious case of Breaking Batch

Discussion in 'UGUI & TextMesh Pro' started by Tinovdk, Jan 9, 2020.

  1. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    83
    After combing through https://learn.unity.com/tutorial/optimizing-unity-ui and having tried things for hours I am at a loss about disparate results in UI draw call batching. I hope the Unity forum can rise to the challenge and offer a solution.

    Case 1 - ✔ Batches as expected
    Shopkeeper545.gif

    Case 2 - ✖ Breaking batches
    Shopkeeper546.gif

    Case 1 has 2 batches. One for the graphics and one for the text despite having a complicated and interwoven hierarchy structure. Perfect!

    Case 2 has 8 batches. Four times one for the graphics and four times one for the text despite having a simple hierarchy structure. The hierarchy does not contain any scripts or layout components. Each gameobject containing a graphic only has a Canvas Renderer and Image component. The "Label" gameobject only has a TMP_Text component. The "Names" gameobject only has a Canvas component. None of the four hierarchy groups have inter-overlapping quads or incorrect child order.

    I am at a loss. What else can I try to discover the reason for the UI batches to break?
     
    Last edited: Jan 9, 2020
  2. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    83
    It turned out that one of the recttransform positions had a negative Z value that caused the batch to break. Totally overlooked that for hours. :oops: