百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
U

Unity-Code-Style-Guide

> 编程语言
开源

一个鼓舞人心的 C# 代码风格指南,适用于 Unity 项目

336 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个鼓舞人心的 C# 代码风格指南,适用于 Unity 项目

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 Wilmer from Unity Game Academy for his significant contribution in bringing the guide together. As style guide is highly opinionated, and as the 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 web-based 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.

What is new?

Based on your feedback we made a few minor changes to our recommendations from the original version. Again, it doesn’t vary a lot from the general C# recommendations or our recommendation to prioritize readability over efficiency, etc. We also added a few more examples so it’s easier to translate the theory into actions in the e-book.

Interested in learning more?

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

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言