Search Unity

Does Addressables.ResourceManager.Acquire use more memory?

Discussion in 'Addressables' started by SleepyAgapornis, Apr 5, 2021.

  1. SleepyAgapornis

    SleepyAgapornis

    Joined:
    Sep 7, 2018
    Posts:
    23
    Hello there!
    I was having an issue with the music of my game so that after loading a new scene and declaring the music object as DontDestroyOnLoad, the music wasn´t persisting.. so I´ve found out that after loading a new addressable scene... all assets of the old scene, even if marked as dontdestroyonload, were released. In order to solve that I had to increase the event count for that scene which originally contained the music using Addressables.ResourceManager.Acquire... at the end it worked well and the music persists. But now my question is... does increasing the event count of a scene consume a lot of memory? For my game, I have to be very careful with memory since it´s a WebGL one.

    I can also increase the event count right before releasing the scene instead of when loading it, so that the event count for that scene is always 1, but I don´t know if that makes a difference?
     
  2. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    It does in the sense that the assets associated with that opHandle never get released unless you call it yourself. So if you have stuff associated with that handle that you don't need in addition to the music, they'll remain. Would be nice if it was possible to acquire the handle on a subasset