Our game shows occasional lag spikes that seem to happen at random intervals. I turned on the microprofiler so I can monitor the resource usage and I was able to record it here:
The link contains the video and the corresponding microprofiler dump. Upon checking, the longest duration pertains to calls to the stepContacts. The lag spike lasts longer for some of my tests but this is the one that I managed to capture in my recording for now.
For the few resources that I can find, I learned that the stepContacts label refers to the collision of objects as determined by CanCollide. The thing is, I set all the CanCollide properties of the parts of these patrolling enemies to false so I thought this should not happen anymore. The only ones with the collision enabled is the player and the pets that follow him/her. Also, when I remove all the patrolling enemies, the lag spike doesn’t seem to occur so I am leaning towards identifying the enemies as the source of the issue.
Given that there are no more parts that have CanCollide set to true for the enemies, is there anything else that I can check to see where this issue is coming from? Or is there anything else that I should check outside of the enemy objects that I am suspecting? Thanks in advance.
UPDATE: So turns out, two of the enemy model’s parts are forced to set their CanCollide properties to true even if my script sets it to false. Given that there are 121 enemy models in the place, does this account to such performance hiccup even with just the two parts (Lower and Upper Torso) set as collideable?
P.S. I checked the previous forum posts before that mention stepContacts but so far I can’t find anything that I can make use of on my problem.