Skip to content

Extension methods to track memory leaks when using unity Addressable Asset System

License

Notifications You must be signed in to change notification settings

RealCosmik/UnityLeakTracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Extension methods to track memory leaks when using unity Addressable Asset System

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages