A Unity Editor extension to run dotnet csharpier
on changed C# source files in /Assets
before compiling them.
C# source files inside the /Packages
folder are not getting touched, as they might not writable.
CSharpier for Unity requires CSharpier to be installed.
Given a valid .NET installation, this can be done on the command line with:
dotnet tool install -g csharpier
The following registry must be added to Unity's Packages/manifest.json
.scopedRegistries[]
:
{
"name": "OpenUPM",
"url": "https://package.openupm.com",
"scopes": [
"com.kagekirin"
]
}
Add com.kagekirin.unitycsharpier
to the Packages/manifest.json
.dependencies{}
:
"dependencies": {
"com.kagekirin.unitycsharpier": "1.1.16",
}
The only important setting to configure is the execution path for dotnet-csharpier
,
which can be done automatically in the Project Settings > CSharpier menu.
CSharpier's formatting behaviour can be configured through the following files located at the root of your Unity project:
-
.csharpierignore
: which defines which files/patterns to ignore (or not ignore) -
.csharpierrc.yaml
: which defines settings such as characters per line, tab width, and usage of tab character.
NOTE: the .csharpierignore
displayed in the menu is currently read-only,
in such that changes are NOT reflected back to the file.
Please refer to COLLABORATION.md