Line length

Code lines are not allowed to exceed 120 characters so that code will always be readable on most screen sizes.


File Names

Every file and folder name is written in UpperCamelCase.


Bracket Placement

Brackets are placed on a new line and not on the same line.

public class ExampleScript
{

}

Namespaces

The namespace name is written in UpperCamelCase and is based on the folder name the script is placed in. Every class needs to be inside of a namespace.

namespace ExampleNamespace
{
    public class ExampleScript : MonoBehaviour
    {

    }
}

Classes

The Class name is written in UpperCamelCase and always has a summary. If the function GetComponent is used to get a component from this GameObject you use RequireComponent above the class.

/// <summary>
/// A summary explaining what the class is for.
/// </summary>
[RequireComponent(typeof(ExampleComponent))]
public class ExampleScript : MonoBehaviour
{
    private void Awake()
    {
        ExampleComponent exampleComponent = GetComponent<ExampleComponent>();
    }
}