CPU Usage ?

Hey guys, i’m working on a small game and i’ve already been experiencing FPS drops and managed to fix them by trial and error, but i’m asking this so i can know in the future where to look, so here it is:
What in scripts takes the most CPU usage ?

Nameley i heard that it’s best to have as little different scripts as possible, and that i should use as least function calls as i can, and overall not write anything useless (too much variable declarations, countless variable checks ect…) so i’d like to know what’s true in all this and what’s not. Also what style of writing, if any, would be the most CPU friendly.

It doesn’t matter if you have 10 or 100 scripts, performance is dependent on what those scripts do.

As for writing styles to reduce CPU usage, the only tip I can recommend is don’t leave any empty Start() or Update() methods, even though they are empty, they still use CPU usage due to how unity calls those methods.

You can use Unity’s built-in profiler to see hat scripts are using up the most CPU usage, as well as any garbage your scripts create.

More info on the profiler here: Unity - Manual: Profiler overview