How to identify hitches during playtime?

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.

Hard to say without seeing the code, but I would start commenting out suspected trouble making code to try to narrow it down. I don’t know what purpose the loops are serving, but one of NASA’s best practices is to put a maximum number of iterations on loops to exit a loop if it goes infinite. Good luck.