Skip to content

Instantly share code, notes, and snippets.

@NickDiMucci
Created August 25, 2014 14:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickDiMucci/93c29b0b0af955fc9cbb to your computer and use it in GitHub Desktop.
Save NickDiMucci/93c29b0b0af955fc9cbb to your computer and use it in GitHub Desktop.
Script to automate build the Windows player of a Unity project, and committing build to a git repo.
@echo off
set PROJECT=-projectPath
set PROJECT_PATH="C:\path\to\your\Unity\project"
set WIN_PATH="C:\path\to\your\game.exe"
@REM Common options
set BATCH=-batchmode
set QUIT=-quit
@REM Builds:
set WIN=-buildWindowsPlayer %WIN_PATH%
@REM Win32 build
echo Running Win Build for: %PROJECT_PATH%
echo "%PROGRAMFILES%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %WIN%
"%ProgramFiles(x86)%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %WIN%
echo Committing build to git
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
echo %mydate%_%mytime%
git commit -a -m "Commit windows build %mydate%_%mytime%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment