• Unity
  • Skeleton Renderer - 250 MB Garbage Collection

Hi guys,

Do you have any suggestions on how we can reduce the SkeletonRenderer.Awake() GC Allocation on scene loading? It results in a 0.5 - 1 second pause around the start of a scene load. :confused:

Thanks for the help!

Related Discussions
...
  • تم التحرير

I assume you are using skeletons in JSON format. Unfortunately, the JSON deserializer produces a lot of garbage, which can be resolved by exporting the skeleton in binary format.

When profiling your game run in the Editor (and not built to a target platform and attaching the profiler there), I just noticed that JSON deserialization will currently produce double the GC overhead, by checking for version compatibility in the Editor and performing an additional deserialization step. I will fix this problem, as it nearly doubles the displayed GC statistics in the Editor compared to when it its built to a target platform.


New unitypackages fixing the unnecessary additional JSON deserialization overhead in the Editor have just been uploaded.
You can get them here as usual:
Spine Unity Download

This issue has been tracked under this issue ticket:
https://github.com/EsotericSoftware/spine-runtimes/issues/1608

Thanks so much for the support on this issue! :nerd:

Yea I've been using JSON since the beginning.

Just out of curiosity, should we re-export everything using BINARY FORMAT ? Are there any issues we should be aware of through this method?

Thanks! 🙂

Yes, we would recommend re-exporting the projects in binary format to lower the memory footprint and speed up loading.

If you have many projects, we suggest automating exporting your project files:
Export - Spine User Guide: Command line
For example, here is a script we use to export all the Spine example projects and to create texture atlases:
spine-runtimes/export.sh at 3.8