Skip to content

Code conventions

Not everything we want to style is configurable in the .editorconfig-file so we document the rules here, and remember to adhere to them.

C# specific

Attributes

Attributes should be on its own line, with a newline before.

[SerializeField]
private int counter;

[SerializeField]
private int bulletsCount;
And joined if there are more than one.
[Min(1), HideInInspector]
private int counter;

Unity specific

Accessibility type for functions

To remove the unused warnings of Unity provided functions they need to use the protected accessibility type.

// Warning: Private member 'Class.Awake' is unused [Project]csharp(IDE0051)
private void Awake() 
{
    // Some code
}

// No warning
protected void Awake() 
{
    // Some code
}

Last update: 2023-07-21

Comments