How you organize your code?

Do you follow any guide or pattern to organize your code within scripts? E.g, public functions declared before private functions or public properties declared before Serialized fields and private properties.

I’m trying to get more consistant on my code and improve the readability

C# is generally quite consistent I try to follow the style guidelines which are pretty well recognised across the industry and generally mirrored by the language/ framwork.


Ironically (and annoyingly) that means completely ignoring Unity who seem to have done their best to ignore the normal conventions.


If you dont have a good sense of that maybe install stylecop and see what it does to your code. Note it seems like most versions arent very well supported these days … the resharper version seems to be though.


Hi @sacredgeometry , thank you very much for the detailed answer.

I haven’t compared C# x Unity code standards. I was writing my code based on just the basics and trying not to do an awkward bunch of lines.

I will compare and see their differences but probably I will follow the microsoft standards as you said it is well recognised.

Thanks for the links but these tools are kinda deprecated guess it won’t fits well with 2022 version according the Q & A section of the marketplace. I will give a try with an old version jus for curiosity.