Search Unity

Unity UI Prevent Canvas call graphic rebuild multiple times when add/remove transform

Discussion in 'UGUI & TextMesh Pro' started by NoDumbQuestion, Mar 6, 2020.

  1. NoDumbQuestion

    NoDumbQuestion

    Joined:
    Nov 10, 2017
    Posts:
    186
    To disable Unity Auto Layout from call rebuild multiple time this frame. I can temporary disable all Layout Components in a Gameobject while adding new transform/gameobject. Then enable it later during LateUpdate so unity only call rebuild layout one.

    I also remember there is a trick from somewhere that allow me to do the same with Canvas and canvas group without disable Canvas Component. Can anyone know the term or show me where I can refind it?
     
  2. eivasilev54

    eivasilev54

    Joined:
    Dec 15, 2017
    Posts:
    2
    you are got answer?
     
  3. NoDumbQuestion

    NoDumbQuestion

    Joined:
    Nov 10, 2017
    Posts:
    186
    I never found the solution again.

    So I move on to change Project structure to More sub-canvas in heavy layout GO.
    You might just need some little tweak to split hierarchy into static and frequent update-GameObject.

    Edit: Change Huge prefab canvas to 1 method RefreshAll() for whole thing help (Even when only change little text inside it). Easier to maintain code, and the performance lost for 1 call in 1 update is acceptable