Thanks for contributing. This package follows the coding standards in .editorconfig and AGENTS.md.
- Open the package inside a Unity 6000.2+ project (or add it via Package Manager).
- Let Unity generate
__ModelLibrary.Editor.csproj/ModelLibrary.Tests.csprojat the Unity project root. - Install pre-commit and enable hooks:
pip install pre-commit
python -m pre_commit installOn Windows, use python -m pre_commit … if the pre-commit command is not found (Scripts folder often missing from PATH after pip --user). To add it permanently, put your Python Scripts directory on PATH (for example %APPDATA%\Python\Python314\Scripts), then reopen the terminal.
Optional: point at a specific Unity project root if the .csproj files are not found by walking upward:
# PowerShell
$env:MODELLIBRARY_UNITY_PROJECT = "C:\path\to\YourUnityProject"
# bash
export MODELLIBRARY_UNITY_PROJECT=/path/to/YourUnityProjectStandalone package clone: if this repo is not under a Unity project (no generated .csproj), dotnet-format skips with a warning and the commit still proceeds. Other hooks (editorconfig-checker, etc.) still run. To fail instead when projects are missing (e.g. CI that embeds the package in Unity):
# PowerShell
$env:MODELLIBRARY_DOTNET_FORMAT_REQUIRED = "1"
# bash
export MODELLIBRARY_DOTNET_FORMAT_REQUIRED=1On every commit, hooks run:
| Hook | What it enforces |
|---|---|
trailing-whitespace / end-of-file-fixer |
Clean text files (skips Unity .meta) |
check-merge-conflict / check-yaml / check-json |
Basic integrity |
check-added-large-files |
Blocks files larger than 1 MB |
editorconfig-checker |
Indentation, charset (UTF-8 BOM for .cs), final newlines from .editorconfig |
dotnet-format |
C# whitespace + error-severity style from .editorconfig on staged .cs when Unity .csproj files are available; otherwise skips |
Run manually:
python -m pre_commit run --all-files
python -m pre_commit run dotnet-format --files Editor/Infrastructure/Utils/SemVer.csSkip a hook temporarily (escape hatch only):
# bash / Git Bash
SKIP=dotnet-format git commit -m "..."
# PowerShell
$env:SKIP = "dotnet-format"; git commit -m "..."From the Unity project root (where __ModelLibrary.Editor.csproj lives):
dotnet format whitespace __ModelLibrary.Editor.csproj --include Assets/ModelLibrary/Editor/Path/To/File.cs
dotnet format style __ModelLibrary.Editor.csproj --include Assets/ModelLibrary/Editor/Path/To/File.cs --severity errorThe hook only checks files in the commit, so older style debt in untouched files does not block you.
- Prefer explicit types (no
var) — enforced by.editorconfig/dotnet format - Follow naming rules in
.editorconfig(_privateField,IInterface,CONST/__PRIVATE_CONST) - Keep editor code under
Editor/ - Target .NET Standard 2.1 (no
IReadOnlySet<T>or other .NET 5+ APIs) - See
AGENTS.mdfor architecture and Unity-specific rules
- Use conventional commits:
feat,fix,chore,docs,refactor,test - Keep changes focused; update
CHANGELOG.mdwhen user-facing behavior changes - Add or update Edit Mode tests under
Editor/Tests/when fixing logic
By contributing, you agree that your contributions are licensed under the MIT License (see LICENSE).