Search Unity

Resolved Question about UI canvas.

Discussion in 'UGUI & TextMesh Pro' started by lospixones, Aug 26, 2022.

  1. lospixones

    lospixones

    Joined:
    Mar 2, 2018
    Posts:
    1
    Hello UI team!

    I was wondering if there is a difference in performance between having multiple canvases separately vs having these multiple canvases nested to a parent canvas.

    Thanks!!!
     
  2. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    It does but what i would consider fairly minor.

    Multiple root canvas's
    - need their own graphic raycaster which increases the processing time to send events as we can't just overlap check a single hierarchy to find the event object.
    - Saves time rebuilding parent canvas when children Canvas's move. As the overlap and batching is positioning dependent, having them separated breaks any interdependency.
    - From a overall batching speed would not have much difference.
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    But each new Canvas will increase 1 more batches. How much it will impact the performance?
     
  4. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Each new Canvas will have AT LEAST 1 more render batch. depending on how elements are stacked and displayed. When uGUI was first written and has to support a iphone 3gs each render batch mattered. On any modernish hardware thats easily accessible today a few more render batches wont make or break performance.