
Hello and Welcome, I’m your Code Monkey!
My BEST Unity performance tip: You don't have to update everything every frame!
This is such a simple tip but so powerful!
Meaning that some logic that you have on your Update(), you could probably run it just once or 5 times per second and it's likely more than enough.
For example, some simple Find Target logic that checks for distance to the player in order to attack. Do you really need to do that check 60+ times per second? No you don't! That’s just a waste of CPU cycles.
Instead use a simple timer (FunctionTimer, or my Toolkit) to run that logic just 5 times per second and everything will behave exactly the same. The player will not notice the Enemy is only looking for a target every 0.2s instead of every 0.02s, but it will be 10x more performant since you're not wasting tons of CPU performance.
This one simple concept is something you can apply to a million different things in your games.
Checking if an Interactable object is in front? Just 5 times per second!
Dealing damage per second? Just once per second!
Re-calculating Pathfinding? Just once per second!
Updating the UI? Use events to only update when it changes!
Basically every time you see code in Update() (and you need some extra performance) just ask yourself, do I REALLY need to run this logic 60 times per second? In most cases the answer is, no.
Thanks for reading! Best of luck in your game dev journey!
Get Rewards by Sending the Game Dev Report to a friend!
(please don’t try to cheat the system with temp emails, it won’t work, just makes it annoying for me to validate)

Thanks for reading!
Code Monkey


