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

Question Finding sprite references in scene with Memory Profiler

Discussion in 'Editor & General Support' started by MikeGDev, Jan 6, 2023.

  1. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    I am trying to optimize sprite atlases by using the memory profiler. We have many atlases loaded into memory and some of them only have references to a few objects in the scene. Therefore it would be nice to get an overview over how many objects each atlas references so that we can group them more efficiently.

    By using the memory profiler I can get an overview of what a sprite atlas is referenced by:

    Sprite->SpriteAtlas->Sprite(->SpriteRenderer)
    upload_2023-1-6_14-33-11.png

    I am only interested in the references to SpriteRenderers, so the question is if it is possible to filter these references so that I can easily see which sprite atlas have references to SpriteRenderers without having to open every hierarchy?
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,119
    Hello Mike,

    Thank you for raising this use case. There is no way to currently do what you want, but I've filed a feature request on your behalf via the Public Roadmap for Profiling.

    Instead of filtering to just showing the used ones, I've assumed that for your use case it might be more relevant to see a clear differentiation of which Sprites in an Atlas (or similarly, which Assets from an Asset Bundle) are used, vs not used at any given time, given that the amount of unused one, and the overall utilization rate might be relevant to that workflow as well.
    I hope that was in line with what you need?
     
    MikeGDev likes this.
  3. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    Yes, thank you for looking into this :) Seeing how many assets are used vs not used is definitely something we need as well. For now I have just made a small tool which uses Resources.FindObjectsOfTypeAll to find all Sprite Atlas and certain types of renderers and then compare sprites from each to see which ones are used and not used.
     
    MartinTilo likes this.