Contributing - achimmihca/UniInject GitHub Wiki

Code Style

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);
}

Tests

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.

⚠️ **GitHub.com Fallback** ⚠️