I noticed that in our game Idle Miner Tycoon we have a Memory leak when creating new Spine Objects and destroying them. So i made a new scene with a very simple Setup to pinpoint the problem:
- empty scene with only a spawner
- Spawner scrip that just instantiates a spine object and basically only calls SkeletonAnimation.Initialize and then destroys that gameObject immediately again
What i found is that the number of meshes and total objects in the scene grows dramatically over time .. and it doesn't seem like it gets garbage collected at all.
Do i need to explicitly destroy every component or something like that ?
We implemented a system which lets the player change the cosmetics (appearance and animation) of the mine workers in the game. Everytime the player changes the cosmetics we change the spine ScriptableObject and then call initialize.
Should we maybe change our system to use skins when changing the cosmetics?