Search Unity

Sprites are loaded in memory even if there are in a sprite atlas - Captured in Editor

Discussion in 'Profiler Previews' started by SebAsmodee, Dec 18, 2018.

  1. SebAsmodee

    SebAsmodee

    Joined:
    Oct 17, 2018
    Posts:
    2
    Hi,

    I have report a bug ( Case 1110373) for a strange behavior of sprite atlas.
    When I use sprite atlas for all my sprites and I capture memory with this tool, the windows shows me that individuals textures and atlas textures are loaded in memory at same time.

    Can you confirm me that behavior is not a bug from the profiler tool but from atlas system ?

    Thanks !
     
  2. alexrvn

    alexrvn

    Unity Technologies

    Joined:
    May 16, 2017
    Posts:
    19
    Hi! Afaik, we crawl all live native objects (eg: Texture2D) with the memory profiler. As such if they are loaded in memory, the memory profiler will display them. Afaik the SpriteAtlas will pack it's Sprites when you enter Playmode hence it would need to read from said resources during OnEnterPlayMode, furthermore those resources are already loaded via edit mode as Sprites will use their Texture2D refs instead of the SpriteAtlas while in edit mode, as such I'd expect to see both the textures referenced being loaded in memory and the sprite atlas itself (Editor only).
     
  3. SebAsmodee

    SebAsmodee

    Joined:
    Oct 17, 2018
    Posts:
    2
    Ok thanks !
    Indeed sprite are not shown when I capture the player.
    By the way nice work !
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    265
    I've renamed the topic so it's search friendly and removed the Bug tag since it isn't one (the corresponding bug has been closed as By Design).

    Just to add to Alex's explanation: When capturing a Play-mode player there is no way to cleanly separate between the player and the surrounding Editor so you'll just get both. As a result, you'll see Editor UI, various Assets and e.g. RenderTextures for Camera Previews and similar stuff in the snapshots.

    So the long and short of it is that for most intents and purposes you should inspect snapshots from built Players on your target platform. This is mentioned in the Documentation but we'll look at ways to make this more obvious in the UI as well. Thanks for highlighting that this is still missing some clarity :)
     
    alexrvn and Sylmerria like this.