Search Issue Tracker
Fixed in 2019.1.X
Votes
0
Found in
Issue ID
932011
Regression
No
[Scripting, Profiler] It's not possible to get runtime size for meshes
With the current APIs Unity provides, it is difficult to determine exactly where the memory footprint for a mesh is coming from, especially during runtime. Get internal memory during runtime in release mode is not possible which leads to estimates which is difficult without knowing the correct format which depends on many different factors. During profiling it's possible, but you will always get the profiler overhead. e.g. via Profiler.GetRuntimeMemorySize (mesh);
For Meshes there is already a call used by the profiler Mesh::GetRuntimeMemorySize() which consists of 2 parts which only return related memory in dev mode, otherwise zero.
- Profiler.GetRuntimeMemorySize (mesh); Includes base memory footprint for C++ objects as well as the base class.
- SharedMeshRenderingData::GetRuntimeMemorySize() returns the index buffer size + the vertex streams included.
So in theory we can enable the second part during runtime as it doesn’t require the profiler. This requires additionally scripting bindings. See the attached diff for the implementation. This returns the size the mesh occupies via mesh.GetRuntimeMemorySize ().
TestStuff.cs tests the call against other API calls in
Debug.Log("GetRuntimeMemorySize: "+mf.mesh.GetRuntimeMemorySize ());
Build the test scene in non development mode to iOS/Android and test on device.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Assets do not get imported from an asset package when Library assets in the asset package are unchanged
- UI Builder looses reference to the opened UI Document when domain reload is done
- The HDR Color picker preview does not display the same color as the standard Color Picker preview
- HDRP Lit Shader errors are thrown and artifacts are generated when using Emissive Map and "Same as Base" UV mapping setting
- NullReferenceException is thrown when assigning PanelSettings asset to a UIDocument dynamically at runtime
Add comment