This was an excellent feature of the old MemoryProfiler that’s still available on Unity’s bitbucket. I was surprised to see it missing in this revamped version.
Is this something you all are planning on adding back in at some point?
This was an excellent feature of the old MemoryProfiler that’s still available on Unity’s bitbucket. I was surprised to see it missing in this revamped version.
Is this something you all are planning on adding back in at some point?
Thank you for the Suggestion
It is something we’d like to add at some point, yes. There are however multiple issues with it currently:
The Editor + Memory Profiler that opens or even takes the snapshot doesn’t necessarily have any relation to the target that is being captured. The target might be outdated or a completely different project.
Once a player is built, there is no direct way to link between the assets used to build it and the instances of the assets loaded in memory at runtime. The instance ID is something that only has meaning in the context of the player, GUIDs are Editor-only IDs.
Any combination of Assets (scene/mesh combines) and modifications in custom build pipelines would mean there is no relation to be made anyways.
The way this is handled in these old cases is by guessing the connection between Asset in the Project ↔ Asset in Memory is through the Native Object Name which is by no means guaranteed to be unique and therefore prone to be wrong.
Now even with these caveats, trying to at least guess the connection so one can easily go from seeing an asset is taking a certain amount of memory to checking how it might look like and checking/changing the settings on it would be valuable. So far though, we’ve focused on making sure we’re collecting and displaying accurate and comprehensive memory data and developing views that make it easy to understand it and results which can be relied on.
Yes, the “easy to understand” part still can do with a lot of improvements and showing this kind of preview would certainly help. Ideally we’d like to be able to reduce the amount of guesswork behind such a preview though. We have gone over several ways in which we could do that but ultimately didn’t have time to focus on this yet.
It would be useful if you store additional information in a “development mode” build, to be able to map a native UnityEngine object in a MemorySnapshot to its asset guid in the project. Or something similar to retrieve information what the source asset in the project was.
This functionality would allow tools to implement powerful functionality. This additional information should be stripped in non-development builds.
I would need this functionality to properly detect asset duplicates:
It would also come in handy to identify the asset to display a preview, as I show in the following video:
Asset preview starts at around 4:10
At the moment, I guess their paths using just the object name, which is of course quite error prone.
Yes, that would be one of the possible solutions to this. Whichever solution we choose though, it’ll likely have to be for newer versions of Unity only.