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.
  2. Dismiss Notice

deactivating entire canvas is expensive what's your fav way of disappearing UI panels?

Discussion in 'UGUI & TextMesh Pro' started by laurentlavigne, Mar 6, 2021.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,994
    upload_2021-3-5_21-7-25.png
    see those mega spikes... ouch
    each panel that activates and deactivates gets a canvas to prevent rebuild.
    it clearly doesn't work that well so what's the better way?
     
  2. Kazen

    Kazen

    Joined:
    Feb 17, 2015
    Posts:
    68
    Deactivating the canvas should be the way to go. Are you sure its not your panels that you're activating/Deactivating?
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,994
    Lemme check:
    I'm activating and deactivating this
    upload_2021-3-9_15-30-39.png
    upload_2021-3-9_15-30-28.png
     
  4. Kazen

    Kazen

    Joined:
    Feb 17, 2015
    Posts:
    68
    I haven't tested. Do you disable the whole object or just the canvas? See if the other fixes the issue or there might be somthing else that's performance-heavy maybe?
     
  5. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,914
    What those "mega-spikes" (actually out of context since you cut off the actual scale from the shots...) contain though? Have you checked? Or you just assume that it is the UI activation/deactivation?
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,994
    I deactivate the gameobject of the canvas
    the megaspike are made of canvas rebuild (they do become mega on the switch)
    upload_2021-3-11_21-0-29.png