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 Is there a way to get or calculate the size of a VFX graph?

Discussion in 'Visual Effect Graph' started by Arrqh, Jun 5, 2023.

  1. Arrqh

    Arrqh

    Joined:
    Mar 31, 2015
    Posts:
    12
    So recently while chasing down some excess memory in our game, I came across a VFX Graph asset one of our artists made where they just made a typo in the capacity of one system. This system happened to be used multiple times in a level. Fixing it dropped the memory usage by almost 300mb! All of this is presumably in compute buffers allocated by each VisualEffect component.

    Is there any way to reliably track the memory allocated by a VisualEffect? I can find no reference to the buffers in the memory profiler (at least in 2021.3). I do see "buffers" in the rendering panel of the profiler but this also includes meshes so you have to do some legwork and this doesn't help track down specific asset issues. Since Unity is allocating and managing these buffers I should think there should be a way of tracking this somewhere?
     
  2. Marie_G

    Marie_G

    Unity Technologies

    Joined:
    Mar 9, 2021
    Posts:
    48
    Hello, currently there is nothing to directly know buffers size but you can do an approximation of it doing (attributesize x capacity) , that will give you the size of the attributes buffer that constitutes the bulk of the memory usage. size of the attributes can be find in the inspector of a context in your graph, it is per system.

    We will try to provide a solution for your issue in the future.
     
    Arrqh and DevDunk like this.
  3. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    306
    Arrqh, Marie_G and DevDunk like this.
  4. Arrqh

    Arrqh

    Joined:
    Mar 31, 2015
    Posts:
    12
    Thanks for the replies, glad to see that there's solutions coming even though I'm stuck on 2021.3 LTS for the moment!

    On more question, I was poking around and found that when I switched the inspector to debug mode with a VFX Asset selected, I am able to see a "buffers" field with a bunch of elements inside it. Is this accurate info/is it worth trying to build our own tool to pull these values? Here's a screenshot with just the default New VFX selected.
     

    Attached Files: