Coder Social home page Coder Social logo

unity-code-style-guide's Introduction

An example of a Unity C# code style guide

Why should you consider a code style guide?

A code style guide provides a clear set of rules or guidelines that each developer on a team should adhere to when writing code. While there is no one correct way to format your Unity C# code, agreeing on a consistent style across the team can help you develop a clean, readable, and scalable codebase. A code style guide helps you remove the guesswork for every member of your team by establishing consensus around important coding conventions, thereby supporting the growth of your codebase into a commercial-scale production. We created this example code style guide as a source of inspiration for Unity developers.

How to use the guide

Find inspiration in existing guides as a starting point to creating your own. Our guide focuses on the most common coding conventions you’ll encounter during Unity development. These are essentially all a subset of the Microsoft Framework Design guidelines, which include an extensive number of rules beyond what is presented here. The guidelines we provide are recommendations, not hard and fast rules. Review each rule in the example style guide and customize it to your team’s preferences. The specifics of an individual rule are less important than having everyone agree to follow it consistently. When in doubt, rely on your team’s own guide to settle any style disagreements. Your style guide should take precedence over our suggestions or the Microsoft Framework Design guidelines, if they are in conflict. This will allow your team to maintain a uniform style throughout your project.

Who created this guide and how can I use it?

We created the guide based on best practices shared by internal and external Unity experts. A big thanks goes to Unity Game Academy for their significant contribution in bringing the guide together. As a lead on the project behind our accompanying e-book, Creating a C# style guide for clean and scalable game code, I chose to make the guide available here on my Unity GitHub account. This guide is a product of our own subjective opinions, and as such, it is legally meant to serve as an example for inspiration only.

You can also find two webbased articles here:
Naming and code style tips
Formatting best practices

Remember, a good style guide is one that fits your needs and covers the majority of the day-to-day use cases in your game development. Our intention is for you to use the style guide as a starting point, or as bits and pieces in your own guide. Download our ebook

Interested in learning more?

If you’d like further inspiration for creating your own code style guide, check out our upcoming blog post and our new e-book, Create a C# style guide: Write cleaner code that scales.

unity-code-style-guide's People

Contributors

thomasjacobsen-unity avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.