Unity Empty URP Template
This is a minimal template for starting a URP Unity project.
Features
- .gitignore for Unity projects
- .gitattributes with Git LFS support
- EditorConfig for consistent code style
- Run linter on pull request
Requirements
- .NET 6.0 SDK
- Git LFS (already included with Git for Windows)
How To Use
- Create a new repository from this template.
- Clone your repository.
cd
into your local repository and rungit lfs install
.- Configure Unity's merge tool in your local repository's git config file (
.git\config
):
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
# Replace with your editor's installation path
cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\UNITY_VERSION\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
- Configure your pre-commit git hook (
.git/hooks/pre-commit
):
#!/bin/sh
if git branch --show-current | grep -q 'main\|master\|trunk'; then
echo "Cannot commit directly to the main branch."
exit 1
fi
solution=$(find . -maxdepth 1 -name "*.sln" -type f | head -1)
if ! git diff --cached --diff-filter=ACM --name-only --quiet "*.cs"; then
git diff --cached --diff-filter=ACM --name-only "*.cs" | dotnet format "$solution" --verify-no-changes --include -
exit $?
fi
- Replace the README and LICENSE with your own.