Help with reading profiler

Hi all I have here a spike but I don’t really know how that helps me. In the screenshot you see the root NetworkCore.Update uses up 630ms, but under that node, those numbers do not at up to 631ms. At first I thought the first item under that node which shows 44 calls with a ms of 5.41ms means 44x5.41ms but that’s not the case because as you can see on the right side of the screenshot, the 44 calls are all really short calls that add up to a total of 5.31ms which is not a problem. But I don’t see how that ads up to 631.40ms in the root node of that method call… and I have no idea how this helps me get rid of the spike since it doesn’t tell me where these numbers come from.

Any help would be greatly appreciated thanks!

do you know what your game is doing at that time ? for instance creating an object, connecting to a server or smething you do based on your user input ? if so, that is your first big clue.

looking at the name, I’d guess its something to do with connecting to a server or something on internet, that could be slow.
If possible look into moving this somewhere else, or maybe when a loading screen is up.

Sorry cant help you track down what it is without more info though.

If all else fails… fall back to the age old… remove bits until it goes away, then you know what is causing it.

Just a side question… What is that Object column on the right, all it says is N/A and never shows what objects…

When a new player logs in armor gets instantiated (or retrieved from a pool/cache if already pooled to attempt to avoid instanciation overhead, not sure if it makes any different). This is when the cpu spikes, but I have no idea why… All I know is it might have something to do with the “dynamic collider.create” calls because sometimes I see a whole stack of those when mant people login at the same time.

sorry, no idea about the ‘object’ column

Sometimes unity keeps things compressed, and decides to de-compress them at run time… say textures or sound… this can sometimes create nasty spikes.
You could try creating them all at the start of the level, then just disable rendering and script update until you need them (or move them far off screen)
but no guarantee this will work, as I have no idea why that would look like NetworkCore

You also mention “new player logs in” could it just be online traffic its waiting for ? that could be slow.

You could also try just removing the dynamic collider, and see if the lag goes away.

Sounds like you have a network game ? maybe this is lag caused by the system syncing all your players when new ones are added.
Does the lag get longer the more players you have ?

also try a global search for networkcore.update maybe the code isn’t hiden in a library and you can get a better idea what it is doing.

sorry, no idea about the ‘object’ column

Sometimes unity keeps things compressed, and decides to de-compress them at run time… say textures or sound… this can sometimes create nasty spikes.
You could try creating them all at the start of the level, then just disable rendering and script update until you need them (or move them far off screen)
but no guarantee this will work, as I have no idea why that would look like NetworkCore

You also mention “new player logs in” could it just be online traffic its waiting for ? that could be slow.

You could also try just removing the dynamic collider, and see if the lag goes away.

Sounds like you have a network game ? maybe this is lag caused by the system syncing all your players when new ones are added.
Does the lag get longer the more players you have ?

also try a global search for networkcore.update maybe the code isn’t hiden in a library and you can get a better idea what it is doing.

Are you running the profiler in deep profile by any chance? Usually when I need to pull more information on a spike, I try a deep profile so I can see as much detail as possible.

I know for networked games, there can be sections of code that are easily hung up on connections and end up taking up alot of time as they wait for some kind of response back. I suggest using a code timer to time sections of code to see how long they take to execute (and not the profiler’s timer, it can’t time specific sections).

Take a look at this link:

Thanks, the network was not the reason. Ends up, the spikes are caused by any new character with armor being spawned. each piece of armor has dynamic colliders built into them. They are disabled when equipped because they are not needed, but when they fall off the character, colliders are needed so it doesn’t fall through the floor. I think when those armor are instantiated, or even when they are retrieved from a cached pool and SetActive(), Unity does something called “dynamic collider.create” which adds up to the spikes. My current work around is to use a co-routine the spread out each piece of armor to enter the scene one after the other so the pause is not so apparent. It’s not a great way to do it, but it removes that spike or the annoying pause whenever a character appears… I’ll need to find a better solution tho.