// Domain Reload
[Dangerous!] if you know what you are doing when writing code, you should give more focus to resetting static variables and unsubscribing from events.
if your project is built in a way where this is possible, go to your project settings and Disable Domaing Reload And Scene Reload.
this will improve compile times noticibly, but can cause unexpected behaviour if your code does not work with static variables correctly.
it will also require you to manually reload the scene every time you want to make any changes.
personally I recommend turning off only domain reload, and using as least static variables as possible. just do it smart, if you like your code it's probably at it's best. I believe in you.
// Hot / Fast Script Reload
this has improved compile times for me far more than anything else.
this requires disabling Domain Reload (from the previous step) to work.
Hot Reload is a way to make Unity Only compile new code, such as new functions or a new debug line.
so instead of compiling your entire project, it will only compile a small part of it.
this works by building only the small part you change to disk and smart-replacing only that part after the program is loaded into the memory.
there are some great plug and play ones from the asset store, and open source ones on github.
games like subnautica also built their own hot reload solutions using open source c# hot reload libraries.
checkout Harmony on github if that interests you.
I got one from the asset store, that supports both playmode and editor hot reloading. after doing this, (and all changes that were written here)
it takes me around 4(ms) to recompile when in play mode / debugging stuff, adding changes or removing general code,
and around 8 seconds to recompile (Actual full assembly definition compilation) when creating new files / classes or renaming existing files.