Basically, I’ve an Island with various NPCs using MoveTo() loops and SetMaterial() on the NPCs themselves and in custom Progress Bars that indicate their HPs.
For additional info on the loops, a NPC loop calls about 6 'MoveTo’s and 2-3 'SetMaterial’s during it’s lifetime and a lot of NPCs can exist at the same time.
After some time, the game starts hitching and I can feel noticeable rollbacks, but I can’t identify where they come from. It doesn’t seem to be a particular issue with the Loops themselves (I’m correctly ending them when needed), from what I’ve debugged so far, but I can’t be sure with the 'MoveTo’s and 'SetMaterial’s.
I suspect of having a memory/network leak somewhere, so what am I missing? Is there a way to Dispose of Material Instances created during runtime that I’m not using?
I’m having to use SetMaterial everytime that I need to change a parameter in it, which I assume creates another instance each time and I can’t set a reference to the already created Instance, so what exactly is the best way to fix or identify the issue?
Thanks in advance.