25% CPU usage on a simple game

Hello guys,

I was designing some new levels for my game, not in the scene view but I created a scene to generate some levels, doesn’t matter, the game am creating is a pretty simple plateformer game with and array of 21x13 of int and every int represent a game object.
In my update function i check if the array needs to be updated by seeing if the gameObjects positions are equal to the position in the array, if not then the game needs to update the array so there my algorithm runs.

I noticed when playing the game that every time i check collision in objects in my array the game stops briefly for some milliseconds, and the more they are enemies in the level the more the lag takes more milliseconds, I underestimated the cost of the calculations so I didn’t care about performance, but no worries about that I can fix it.
However i came here to ask if the 25% CPU usage is normal for a game that do some calculation in every 0.5 Seconds?

That depends what CPU you have, but for mediocre+ CPU simple calculation in half a sec shouldn’t take 25%.

I’d suggest you to use Profiler in order to find out what causes it and report back with code or whatever takes a lot of CPU usage.

P.S. Most likely you just use some high-res resources with animation or complicated particles or just lots of objects, well in any case use profiler to find out so that no one will need to guess.