Search Unity

Canvas.SendWillRenderCanvases allocating a lot of memory

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by gavin_dodd, Feb 24, 2017.

  1. gavin_dodd

    gavin_dodd

    Joined:
    Oct 20, 2015
    Posts:
    6
    SendWillRenderCanvases is allocating ~90k/frame

    I have a very dynamic set of images. I am pooling them but the sprite, matrix, active state etc. are touched every frame. I think if the set of images does not change then the same gameobects should get the same data set but even then the allocations stay the same.

    If I pause the game no images are touched and the allocation drops to ~9k, but even that seems high.

    There are 4 canvases (3 used to render to texture) and ~50 images in the scene and not much else.
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    660
    If one thing changes inside one canvas, all graphics in that canvas are rendered again.
    If you separate static things from things that change often with (sub-) canvases you can increase performance. Maybe it is even a good idea to separate the changing canvases more and pack things together which also change together...
     
  3. gavin_dodd

    gavin_dodd

    Joined:
    Oct 20, 2015
    Posts:
    6
    The problem is that everything is changing all the time.

    I think I was a bit tired when I posted so I forgot my actual question.

    What is allocating the memory and is there any way to reduce it?
    Currently GC is triggering every few seconds which is pretty annoying.
     
  4. mushdevstudio

    mushdevstudio

    Joined:
    May 9, 2014
    Posts:
    29
    When I disabled Pixel Perfect on the canvas the frame rate drop went away.