Skip to content

Commit

Permalink
Upgrade to Unity 2019-1.8f1
Browse files Browse the repository at this point in the history
Upgraded to to work with Unity versions after Unity Hub was introduced. Tested against Unity 2019.1.8f1. Also improvement to code that detects and closes Unity and Devenv whilst we are building. Also detects build success and failure and prints better messaging.
  • Loading branch information
alanmur committed Jun 28, 2019
1 parent 96597a9 commit f5f4019
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -2,7 +2,9 @@
/[Oo]utput/
/[Ee]nvironment/
/[Pp]roject[Ss]ettings/
/[Pp]ackages/
/[Ll]ogs/
/[Tt]emp/
/[Oo]bj/

SDK/*/Net35/bin/
SDK/*/Net35/obj/
Expand Down Expand Up @@ -44,6 +46,7 @@ sysinfo.txt

DeployTool/bin/
DeployTool/obj/
DeployTool/packages/
Backend/bin/
Backend/obj/
SDK/GameLift-CSharp-ServerSDK-3.3.0/Net35/Dependencies/EngineIoClientDotNet-master/Src/EngineIoClientDotNet.net35/bin/Release/net35/EngineIoClientDotNet.dll
Expand Down
51 changes: 42 additions & 9 deletions Build/buildconfig.bat
Expand Up @@ -62,28 +62,61 @@ FOR /L %%A IN (1,1,100) DO IF "!CONFIGNAME:~-1!"==" " SET CONFIGNAME=!CONFIGNAME
:BUILD
ECHO BUILDING %CONFIGNAME%

REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING. IF UNITY IS NOT RUNNING THEN IT WILL THROW AN ERROR MSG TO STDERR.
REM BUT WE DON'T CARE ABOUT THAT SO CAPTURE THE STDERR OUTPUT AND IGNORE IT.
TASKKILL /IM unity.exe 2> NUL

REM WHICH UNITY ARE WE USING (32- OR 64-BIT)?
IF EXIST "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles(x86)%\Unity\Editor\Unity.exe"
IF EXIST "%ProgramFiles%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles%\Unity\Editor\Unity.exe"
:KILLUNITY
REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING.
TASKLIST | FIND /I "UNITY.EXE" >NUL && (
TASKKILL /IM "UNITY.EXE" /F
GOTO KILLUNITY
)


REM REMOVE OLD OUTPUT FOLDER
IF EXIST "%ABS_ROOT%\Output\%CONFIGNAME%" RMDIR /S /Q "%ABS_ROOT%\Output\%CONFIGNAME%"


REM WHICH UNITY EXECUTABLE WILL WE USE?
FOR /f "delims=" %%F IN ('DIR "%ProgramFiles%\Unity\Hub\Editor\" /b /on') DO SET UNITYVERSION=%%F
IF EXIST "%ProgramFiles%\Unity\Hub\Editor\%UNITYVERSION%\Editor\Unity.exe" (
SET UNITYEXE="%ProgramFiles%\Unity\Hub\Editor\%UNITYVERSION%\Editor\Unity.exe"
) ELSE (
IF EXIST "%ProgramFiles%\Unity\Hub\Editor" GOTO ERRORINVALUNITY
IF EXIST "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles(x86)%\Unity\Editor\Unity.exe"
IF EXIST "%ProgramFiles%\Unity\Editor\Unity.exe" SET UNITYEXE="%ProgramFiles%\Unity\Editor\Unity.exe"
)
IF "" EQU "%UNITYEXE%" GOTO ERRORNOUNITY
ECHO USING %UNITYEXE% TO BUILD


REM DO A BUILD OF THE STANDALONE USING THE UNITY COMMAND LINE.
%UNITYEXE% -nographics -batchmode -projectPath "%ABS_ROOT%" -buildWindows64Player "%ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity.exe" -quit
%UNITYEXE% -batchmode -buildTarget Win64 -projectPath "%ABS_ROOT%" -buildWindows64Player "%ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity.exe" -quit


REM DID THE BUILD COMPLETE SUCCESSFULLY?
IF NOT EXIST "%ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity.exe" GOTO BUILDFAILED

REM COPY THE PLUGIN TO THE BUILD DIRECTORY
COPY %ABS_ROOT%\Output\Intermediate\GameLiftClientSDKPlugin\Release\GameLiftClientSDKPlugin.dll %ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity_Data\Plugins > NUL
COPY %ABS_ROOT%\Plugin\Sdk\GameLiftServer\GameLift-CSharpSDK-3.1.3\Net35\bin\Release\*.dll %ABS_ROOT%\Output\%CONFIGNAME%\Image\GameLiftUnity_Data\Plugins > NUL


REM FINISHED
ECHO BUILD COMPLETE. SEE %LOCALAPPDATA%\Unity\Editor\Editor.log
ECHO BUILD COMPLETED SUCCESSFULLY. SEE %LOCALAPPDATA%\Unity\Editor\Editor.log
EXIT /B 0

:BUILDFAILED
ECHO BUILD FAILED: LOG AT %LOCALAPPDATA%\Unity\Editor\Editor.log
ECHO SEE %ABS_ROOT%\Build\buildconfig.bat
EXIT /B 0

:ERRORNOUNITY
ECHO "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" OR "%ProgramFiles%\Unity\Editor\Unity.exe" NOT FOUND
ECHO BUILD FAILED: UNITY IS NOT INSTALLED
ECHO See %ABS_ROOT%\Build\buildconfig.bat
ECHO SEE %ABS_ROOT%\Build\buildconfig.bat
EXIT /B 0

:ERRORINVALUNITY
ECHO "%ProgramFiles(x86)%\Unity\Hub\Editor\" WAS FOUND BUT A VALID VERSION WAS NOT
ECHO BUILD FAILED: UNITY IS NOT VALID VERSION
ECHO SEE %ABS_ROOT%\Build\buildconfig.bat
EXIT /B 0
18 changes: 14 additions & 4 deletions Build/clean.bat
Expand Up @@ -14,11 +14,19 @@

@ECHO OFF

REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING. IF UNITY IS NOT RUNNING THEN IT WILL THROW AN ERROR MSG TO STDERR.
REM BUT WE DON'T CARE ABOUT THAT SO CAPTURE THE STDERR OUTPUT AND IGNORE IT.
TASKKILL /IM unity.exe 2> NUL
:KILLUNITY
REM TASKKILL KILLS THE UNITY.EXE PROCESS IF IT IS RUNNING.
TASKLIST | FIND /I "UNITY.EXE" >NUL && (
TASKKILL /IM "UNITY.EXE" /F 2> NUL
GOTO KILLUNITY
)

REM <TODO> CLOSE MSVS TOO?
:KILLDEVENV
REM TASKKILL KILLS THE DEVENV.EXE PROCESS IF IT IS RUNNING.
TASKLIST | FIND /I "DEVENV.EXE" >NUL && (
TASKKILL /IM "DEVENV.EXE" /F 2> NUL
GOTO KILLUNITY
)

REM ------- FIND MY ABSOLUTE ROOT -------
SET REL_ROOT=..\
Expand All @@ -35,6 +43,8 @@ IF EXIST "%ABS_ROOT%\Assets\Plugins" RMDIR /S /Q "%ABS_ROOT%\Assets\Plugins"
IF EXIST "%ABS_ROOT%\Library" RMDIR /S /Q "%ABS_ROOT%\Library"
IF EXIST "%ABS_ROOT%\Environment" RMDIR /S /Q "%ABS_ROOT%\Environment"
IF EXIST "%ABS_ROOT%\Output" RMDIR /S /Q "%ABS_ROOT%\Output"
IF EXIST "%ABS_ROOT%\obj" RMDIR /S /Q "%ABS_ROOT%\obj"
IF EXIST "%ABS_ROOT%\Logs" RMDIR /S /Q "%ABS_ROOT%\Logs"
IF EXIST "%ABS_ROOT%\ProjectSettings" RMDIR /S /Q "%ABS_ROOT%\ProjectSettings"
IF EXIST "%ABS_ROOT%\Temp" RMDIR /S /Q "%ABS_ROOT%\Temp"
IF EXIST "%ABS_ROOT%\.VS" RMDIR /S /Q "%ABS_ROOT%\.VS"
Expand Down
3 changes: 2 additions & 1 deletion Configurations/Client/ProjectSettings/ProjectVersion.txt
@@ -1 +1,2 @@
m_EditorVersion: 2017.4.6f1
m_EditorVersion: 2019.1.8f1
m_EditorVersionWithRevision: 2019.1.8f1 (7938dd008a75)
3 changes: 2 additions & 1 deletion Configurations/Server/ProjectSettings/ProjectVersion.txt
@@ -1 +1,2 @@
m_EditorVersion: 2017.4.6f1
m_EditorVersion: 2019.1.8f1
m_EditorVersionWithRevision: 2019.1.8f1 (7938dd008a75)
17 changes: 17 additions & 0 deletions Packages/manifest.json
@@ -0,0 +1,17 @@
{
"dependencies": {
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0"
}
}

0 comments on commit f5f4019

Please sign in to comment.