Identify loaded assets that are not in use

Hey,

I’m currently working on handling memory usage, or more specifically loading and unloading assets when they are no longer needed.

I found this method which allow you to identify all currently loaded assets:

pc.app.assets.list().filter(asset => asset.loaded);

However, what I have trouble figuring out is weather it is possible to filter even further for assets that are not currently in use. Aka that has no reference to any entity in the scene.

This would be super useful in order to identify which assets are no longer needed, and since the editor seems to be able to do this, I have a tiiny hope this would be possible. Anyone know a convenient way to identify loaded assets that are not currently in use?