You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All code contributions are subject to the following requirements:
2
4
3
-
All C# code must be up to Microsoft's [C# Coding Conventions](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
4
-
In the past Unity used conventions like using `m_variableName` and such practices can still be found in legacy code. However going forward Microsoft's conventions are now the standard.
5
+
All C# code must be up to Microsoft's [C# Coding Conventions](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions). In the past Unity used conventions like using m_variableName and such practices can still be found in legacy code. However going forward Microsoft's conventions are now the standard.
5
6
6
7
In addition to the C# coding standards there is a prefered comment and region structure to follow.
7
8
8
-
* Encapsulate all properties in a #region labeled: `Properties:`
9
-
* Encapsulate all Monobehaviour Initializers, Updates, Gizmos and IEnumerators in a #region labeled: `Initialization & Updates`.
10
-
* Emcapsulate Methods in a #region labeled: `Methods:` within this region you can have sub regions labeled to your liking.
9
+
* Encapsulate all properties in a #region labeled: Properties:
10
+
* Encapsulate all Monobehaviour Initializers, Updates, Gizmos and IEnumerators in a #region labeled: Initialization & Updates.
11
+
* Encapsulate Methods in a #region labeled: Methods: within this region you can have sub regions labeled to your liking.
12
+
* Triple slash summary comments must be used on all public methods and properties that are not obviously named. These summary comments corralate to the descriptions in the documentation.
11
13
12
-
Triple slash summary comments must be used on all public methods and properties that are not obviously named.
13
-
These summary comments corralate to the descriptions in the documentation.
14
14
```csharp
15
15
///<summary>
16
16
/// your summary...
@@ -20,21 +20,19 @@ YourMethod()
20
20
//your code.
21
21
}
22
22
```
23
-
24
23
Sometimes when there is a private field/method that isn't very well named it is a good idea to add a summary comment there as well.
25
24
26
25
Additionally over any public property field that will be displayed in Unity's inspector window include:
27
-
```csharp
26
+
27
+
```csharp
28
28
[ToolTip("Your tooltip text")]
29
-
```
29
+
```
30
30
31
31
Sometimes with very obviouslty named fields that are self explanitory it isn't necessary to add a tooltip attribute, but in most cases it is prefered.
32
32
33
-
In some cases it is prefered to be more strict than Microsoft's conventions such as `var` is rarely if ever used, instead a known type should be used.
34
-
Additionally when checking if statements `== true/false` is always used instead of `if(variableName)` These two practices are done to reduce ambiguity.
35
-
36
-
After putting in a pull request it is helpful (but not necessary) to also document them by putting in a pull request to [The documentation repo](https://github.com/Kitbashery/kitbashery.github.io/tree/main/docs) and update the docs.
37
-
Doing so however does not mean your additions/changes will be accepted so it may be best to add docs after your changes have been merged or let an official developer document the changes.
33
+
In some cases it is prefered to be more strict than Microsoft's conventions such as var is rarely if ever used, instead a known type should be used. Additionally when checking if statements == true/false is always used instead of if(variableName) These two practices are done to reduce ambiguity.
38
34
35
+
After putting in a pull request it is helpful (but not necessary) to also document them by putting in a pull request to The documentation repo and update the docs. Doing so however does not mean your additions/changes will be accepted so it may be best to add docs after your changes have been merged or let an official developer document the changes.
39
36
40
37
Code that deviates to far from these guidelines may not be merged untill it is revised and/or fits within the scope of the project.
0 commit comments