-
-
Notifications
You must be signed in to change notification settings - Fork 2
Contributing
achimmihca edited this page Nov 21, 2020
·
1 revision
The code style has been configured in .editorconfig
file in the Unity project folder.
Please make sure that your IDE is using this style.
- Indent using 4 spaces
- All braces get their own line
- PascalCase: NameSpace, Class, IInterface, EEnum, Method, Property, Constant, Event
- Only strictly typed variables
- camelCase: parameters, all fields
- Prefixes: E for enums, I for interfaces, but none for private or static fields
- Suffixes: "Scene" for scenes, "Controller" for the main class handling a scene (e.g. "MainScene.unity" has an associated "MainSceneController.cs")
- No acronyms, except for the above mentioned prefixes and common abbreviations, such as Http or Xml
- In code, acronyms should be treated as words. For example: XmlHttpRequest
- Only use public where necessary
- Avoid static where possible
Example:
public class MySceneController
{
public int publicField;
int packagePrivate;
private int myPrivate;
protected int myProtected;
public string MyProperty { get; private set; }
public event Action<int> ValueChanged;
}
public enum EDay
{
Today, Tomorrow
}
public interface IXmlReader {
void ReadXml(string filePath);
}
The tests can be run via Unity's Test Runner. Open it via Window > General > Test Runner.
At the moment, most of the tests are made to be run in EditMode. Thus, the tests can be found in Assets/Editor/Tests.