Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Latest commit

History

History
45 lines (35 loc) 路 1.05 KB

STYLE-GUIDELINES.md

File metadata and controls

45 lines (35 loc) 路 1.05 KB

Code style guidelines

Guidelines are guidelines, not rules. But we have some rules here too, and they really should be followed.

Rules

Rule 1:

The using UnityEditor statement MUST be wrapper in a #if UNITY_EDITOR region.

#if UNITY_EDITOR
using UnityEditor;
#endif 

Guidelines

Guideline 1:

Explicit types are preferred. This helps remove guessing work, instead of doing this

var fillColorArray= new Color(2, 123, 93);
var chukSize = 48;
var isLifeMeaningfull = false;
var chunks= new List<int>();

please do **this **

int chukSize = 48;
bool isLifeMeaningfull = false;
Color fillColorArray = new Color(2, 123, 93);
List<int> chunks = new List<int>();

Guideline 2:

Some people think round brackets (US: parentheses) are redundant and unnecessary. I think, especially when looking at others code, it helps shown what the arithmetic expression is doing. So instead of this;

int foo = 10 + 3 / 39 + 19 + 23 + 10 * 2;

please do this

int foo = (((((10 + 3) / 39) + 19) + 23) + 10) * 2;