Profiler.GetRuntimeMemorySize(xxxx) always returns 0

Profiler.GetRuntimeMemorySize always returns zero if you pass a Material or Animation. The Unity reference says this function supports those objects, but I haven’t had any luck so far. Textures, Meshes, and Audio are calculated correctly.

Question: Why can I not retrieve the memory size of Materials and Animations? Is this a bug? an oversight in the reference? Am I missing something? Thanks for reading my question.

OK I figured it out.

To get material memory, you need to pass the sharedMaterial, just like Meshes, you need to pass sharedMesh.

I couldn’t get Animations, but calculating the AnimationClips do work.