Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active April 7, 2021 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unitycoder/b4f6b38b4809df87006534392a239dd3 to your computer and use it in GitHub Desktop.
Save unitycoder/b4f6b38b4809df87006534392a239dd3 to your computer and use it in GitHub Desktop.
Unity Compress WebGL Build Manually from Commandline (Brotli)
echo off
REM add egg path
set PYTHONPATH=D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist/Brotli-0.4.0-py2.7-win-amd64.egg
REM rename uncompressed data files (because brotli cannot overwrite same file that its packing)
move /Y "F:\Your\Project\Build\uncompressed.wasm.framework.unityweb" "F:\Your\Project\Build\uncompressed.wasm.framework.unityweb2"
move /Y "F:\Your\Project\Build\uncompressed.wasm.code.unityweb" "F:\Your\Project\Build\uncompressed.wasm.code.unityweb2"
move /Y "F:\Your\Project\Build\uncompressed.data.unityweb" "F:\Your\Project\Build\uncompressed.data.unityweb2"
REM compress
"D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" "D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Brotli\python\bro.py" -o "F:\Your\Project\Builds\uncompressed\Build\uncompressed.wasm.framework.unityweb2" -i "F:\Your\Project\Builds\\uncompressed\Build\uncompressed.wasm.framework.unityweb" --comment "UnityWeb Compressed Content (brotli)"
"D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" "D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Brotli\python\bro.py" -o "F:\Your\Project\Builds\\uncompressed\Build\uncompressed.wasm.code.unityweb2" -i "F:\Your\Project\Builds\\uncompressed\Build\uncompressed.wasm.code.unityweb" --comment "UnityWeb Compressed Content (brotli)"
"D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" "D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Brotli\python\bro.py" -o "F:\Your\Project\Builds\\uncompressed\Build\uncompressed.data.unityweb2" -i "F:\Your\Project\Builds\\uncompressed\Build\uncompressed.data.unityweb" --comment "UnityWeb Compressed Content (brotli)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment