Skip to content

Setup your Unity Projects to work better with Git.

Notifications You must be signed in to change notification settings

Maoyeedy/UnitySetup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity Project Setup Scripts

Make Unity Projects work better with VCS.

Screenshot

What they do

  • Add mergetool unityyamlmerge to .git/config (to be used with .gitattributes)
  • Add mergerules to make unityyamlmerge ignore negligible differences. (Source)
  • Add hook to auto-update submodules after git pull/merge

(Details can be found in each Scripts/*.ps1, you may modify them to your liking.)

Installation

Download as zip, and extract to Unity project root.

Or clone the repository:

cd $UnityProjectRoot
git clone https://www.github.com/Maoyeedy/UnityProjectSetupScripts.git .setup
rm -r -fo .setup/.git

Or add as submodule:

git submodule add https://www.github.com/Maoyeedy/UnityProjectSetupScripts.git .setup

Or use degit:

degit Maoyeedy/UnityProjectSetupScripts .setup

Usage

Recommended

Double-click Setup.bat - it'll launch powershell with admin rights and run everything.

Manually

# Launch new admin powershell with this
& ./.setup/Setup.bat

# Run each script separately
powershell -NoProfile ./.setup/Scripts/setup-unityyamlmerge.ps1

Troubleshooting

  • Run powershell -Command "Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force" if script can't execute.
  • Unity Hub should be installed, as I use $env:APPDATA\UnityHub\secondaryInstallPath.json to retrieve installation paths.
  • Unity and Git need to be installed, of course.

TODO

  • Add --verbose argument.
  • Add more null/return checks.
  • Make Setup.bat has interactive 'which scripts to run' toggles.
  • Make it work on Linux and MacOS.
  • Make it able to run with irm | iex