Advice for new GameDev Unity projects (Advanced)

Three gifts for game devs using Unity.

I've worked for 15 years on all types of crazy projects, not only on Unity, but on other platforms... and let me tell you what you are doing wrong.

Most of them had the same problem, and it can't be easily fixed at the middle of the project. It means a huge amount of money (time) gone to the toilet.

If you start a new project, please do the following, and you will save massive amounts of dev time and money.

Force encapsulation and simplify

New classes, structs, should do ONE THING. Just one. They should have small functions that can be tested. Simple input and output. Try not to allow bigger methods than 20 or 30 lines. If you have them, it means something is probably wrong. Separate it in several functions, with as few inputs and outputs as possible.

It makes dev easier, new people will understand the code better, less bugs, testable code.

Prepare for Unit Testing

You probably don't know how to do Unit tests. That's what I've seen in general. Nobody does them. It kind of takes time and people hate to do tests. Learn how to do it. It's very simple.

Force the team to write tests, teach them if they don't know how, make guides for them. And at least do simple tests.

But do Unit tests for the core functionality, specifically. If you have a class that is made for a data struct that is used everywhere in the game, or the inventory system, or whatever feature, then test it very much, to avoid having problems with any future change. The CORE must work perfectly. 

Don't listen to the typical "It's finished, who is going to change it now?". It will change, believe me.

Make the team run tests before doing any Pull Request / merge or whatever they do.

Unit tests can't be easily done afterwards if you don't have the mindset from the beginning. Nobody will want it unless it is done from the beginning.

It makes code robust and difficult to break, at least the basic parts, the data management, the basic classes of your game will be undestructible.

Always use Assembly Definition Files

Learn how to use assemblies. It is dead simple. Most assets from the asset store use it. Some people say they don't work and stopped using them. Don't listen to them, they work. For what you need them, they do.

Separate the code in sections, and add an assembly file on each folder. If you can, even separate features.

It makes compilation time faster, because when code changes, only the related assemblies are updated too.

And forces the team to be clean in code references, so helps encapsulation and relationships between sections. And it is mandatory for Unit Tests, which need a test assembly and related assemblies linked to it.

Compilation time will be much lower, code will be less intertwined

Let me know if I missed something in the comments.