Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.49 KB

README.md

File metadata and controls

29 lines (21 loc) · 1.49 KB

UnityLeakTracker

Unity's addressable asset system uses ref counting to track when to unload asssets, however they dont expose the ref count on the given asset. These extension methods on AssetReference<T> are a thin layer atop the addressables system that tracks ref counters and also keeps a pointer to the object that requested the load.

API usage is non intrusive on existing project structures

public class AMonobehavior
{
    AssetReference<UnityEngine.Object> someAsset;
    public void Start()
    {
      someAsset.LoadAssetAsync(this)
    }
}

Access to leak tracker window can be found inside the tools Menu LeakTrackerInfo

easy to tell that each asset in the image wont be released until both of those gameobject release their handles.

Optional Gc.Collect button because when debugging assets I sometime manually call the GC to see if/why a pointer is dangling or not

in project usage

I used this tool when developing this project because the in-game shop was extremly asset heavy and it was a pain to keep track of which assets were loaded into memory