Introducing the C# Style Guide

Eric Van de Kerckhove
Check out the new C# style guide!

Check out the new C# style guide!

The Unity Team at has grown a lot in the past year. At this point, we’ve released over 20 free Unity tutorials, and even a brand new Unity book.

Now that the team has grown, we want to make sure we keep our style consistent, following the modern C# and Unity conventions developers are acquainted to.

So today, the team and I are proud to announce the official C# style guide!

Let’s take a look at what’s inside.

Guide Highlights

At this point, the guide is fairly basic. It contains guidance on the following items:

  • Case. Case can be confusing – sometimes it’s best to use camelCase, and sometimes it’s best to use PascalCase. We try to clarify what’s best where.
  • Code blocks. Indentation should always be done using spaces. Blocks of code should always be indented 4 spaces.
  • Braces. All braces get their own line. This follows the C# convention and improves readability. Conditional statements are always required to be enclosed with braces, irrespective of the number of lines required.
  • Switch statements.. Never include the default statement, this only clutters up the code and should be removed.

To learn more, check out the full C# style guide.

Where To Go From Here?

We know everyone has a different opinion on a certain style of code and we’d love to hear yours!

If you have any suggestions on how to improve this code even further, post issues on the GitHub page or file pull requests – I’ll be watching for them, and if you can convince me (and the rest of the team), we’ll change the guide.

We hope you like the new and improved C# style guide – you can look forward to some awesome Unity tutorials coming up that will be using it! :]

Eric Van de Kerckhove

Eric is a belgian hobbyist game dev and has been so for more than 15 years.
He started with DarkBasic, RPG Maker, Game Maker & XNA and now he makes games using Unity.
Eric also takes interest in 3D modeling, vector art and playing video games.
He is the proud Unity team lead.

Other Items of Interest

Save time.
Learn more with our video courses. Weekly

Sign up to receive the latest tutorials from each week, and receive a free epic-length tutorial as a bonus!

Advertise with Us!

PragmaConf 2016 Come check out Alt U

Our Books

Our Team

Video Team

... 27 total!

iOS Team

... 83 total!

Android Team

... 47 total!

Unity Team

... 16 total!

Articles Team

... 4 total!

Resident Authors Team

... 32 total!

Podcast Team

... 4 total!

Recruitment Team

... 8 total!

Illustration Team

... 4 total!