| identifier | rule |
|---|---|
| Namespace | PascalCase |
| Class | PascalCase |
| Interface | IPascalCase |
| Type Variable | TPascalCase |
| Enum | PascalCase |
| Struct | PascalCase |
| Public Const | PascalCase |
| Private Const | PascalCase |
| Public Static Property | PascalCase |
| Private Static Property | PascalCase |
| Public Static Field | PascalCase |
| Private Static Field | s_camelCase |
| Public Property | PascalCase |
| Private Property | PascalCase |
| Public Field | PascalCase |
| Private Field | _camelCase |
| Method | PascalCase |
| Event | PascalCase |
| Parameter | camelCase |
| Local Const | PascalCase |
| Local Variable | camelCase |
| Local Method | PascalCase |
Every Line Break is Allman Style
namespace FooNamespace
{
class BarClass<T> : ExtensionClass where T : new()
{
public int SomeSimpleProperty { get; set; }
public int SomeOtherSimpleProperty => _valueField;
public int SomeComplexProperty
{
get
{
// Some body...
}
}
private void SomeMethod()
{
if (someCondition)
{
_someValue =
anyCondition
? option1
: option2;
_someCalculation =
operand1
+ operand2
+ operand3;
}
}
}
}If there is too many methods in component so distinguishing Unity Event methods from other methods, consider using #region Unity Events #endregion Unity Events to mark them.
Often, third party packages or plugins place their required assets under very top level of Assets/ directory. (e.g. Assets/TextMeshPro/)
So to place Project's own files under Assets/<project name>/ directory is recommended. (e.g. Assets/MySampleProject/Scripts/)
Assets/
├ MyProject/
│ ├ Scripts/
│ ├ Textures/
│ ├ Atlases/
│ ├ Sounds/
│ ...
│
├ SomeCommonToolkit/
├ AddressableAssetSettings/
├ TextMeshPro/
├ Plugins/
└ other-sdk-generated-things-gibberish/
Both PascalCase, without space. Underbar is ok if needed. (e.g. UI_DefaultButton.asset)
In most of the cases, assets that are made outside of unity has their own naming scheme depending of their authors.
If project is already on track and normalizing requires significant changes, follow existing rule for that particular type of assets.
Original files must be in png format, or equivalent lossless format. If another compression format is needed due to file size, use atlas settings or image import settings instead.
Original files must be in .wav format, or equivalent lossless format.
But if original sound is too long, (typically bgms over 1 minute) ask sound person for compressed file with acceptable sound quality.
Actual encoding format can vary depending on target platform. Discuss with team for this.
Turn off 'Raycast Target' from TMP default. In the most of the cases, text mesh just doesn't need to be clicked by itself.