Reproduction steps:
1. Open the attached “IN-95803.zip” project
2. Open the “SampleScene”
3. Open the “Frame Debugger” Window (Window > Analysis > Frame Debugger)
4. Enable the Frame Debugger
5. Search for “Canvas.RenderSubBatch” and observe its draw call value
6. From the Hierarchy, select any “Canvas” child GameObject
7. Modify its Z Position value from the Inspector to anything other than “0”
8. Observe the “Canvas.RenderSubBatch” draw call value in the Frame Debugger
Expected result: The draw call value remains “3” and batching does not break
Actual result: The value increases to “6” or higher (depending on which GameObject was selected in the 6th step) and batching breaks
Reproducible with: 2022.3.59f1, 6000.0.41f1, 6000.1.0b9, 6000.2.0a6
Reproducible on: Windows 11
Not reproducible on: no other environment tested
Notes:
- If all GameObjects have the same Z Position value (e.g. “1”) the batching still works correctly
- For example, if all GameObjects have a Z position of “0” except icon #4, then all the UI objects before #4 are batched together, then #4 is drawn and the elements after are batched together, resulting in 8 batches
- If the Prefab is modified so that individual Image GameObjects are offset on the Z axis, nothing batches at all resulting in 27 draw calls
- Could not reproduce with Image that is not in a Prefab