/unity-empty-urp-template

Primary LanguageC#Creative Commons Zero v1.0 UniversalCC0-1.0

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

How To Use

  1. Create a new repository from this template.
  2. Clone your repository.
  3. cd into your local repository and run git lfs install.
  4. 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"
  1. 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
  1. Replace the README and LICENSE with your own.