• RuntimesUnity
  • RenderExistingMesh causes GC Alloc

Hello.

When I Use RenderExistingMesh Component, I noticed that GC Alloc is occurring every frame.

When calling sharedMaterials, using GetSharedMaterials can avoid GC Alloc.

Material[] parentMaterials = referenceRenderer.sharedMaterials;
(Line136, RenderExistingMesh.cs)

I'm sorry if my point is wrong.
Thank you.


Using version.
Unity 2022.3.27
Spine 4.1

Related Discussions
...

@Harald

Thank you for quick fix!
But it seems the sharedmaterials part of UpdateMaterials, which is called every frame, is not fixed.
Is it possible to fix this line?

https://github.com/EsotericSoftware/spine-runtimes/blob/568e5ef0494ffa2d20ee82d4a67340b162c16d72/spine-unity/Assets/Spine%20Examples/Scripts/Sample%20Components/RenderExistingMesh.cs#L153

@Harald

Thank you! I checked the code.
It was very helpful.

@kido0617 Glad it helped, thanks for reporting!