Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Buildalon Unity Setup

Discordmarketplaceactions

A GitHub Action for setting up the Unity Game Engine on GitHub Action Runners.

How to use

workflow

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]unity-version:
- None
- 2019.4.40f1 (ffc62b691db5)
- 2020.x
- 2021.3.x
- 2022.3
- 6000.0.x
- 6000.1.*
- 6000include:
- os: ubuntu-latestbuild-targets: StandaloneLinux64, Android, WebGLmodules: linux-server
- os: windows-latestbuild-targets: StandaloneWindows64, Android, WSAPlayermodules: windows-server
- os: macos-latestbuild-targets: StandaloneOSX, Android, iOS, VisionOSmodules: mac-serversteps:
- uses: buildalon/unity-setup@v2id: unity-setupwith:
version-file: 'path/to/your/unity/project/ProjectSettings/ProjectVersion.txt'unity-version: ${{ matrix.unity-version }} # overrides version in version-filebuild-targets: ${{ matrix.build-targets }}modules: ${{ matrix.modules }}cache-installation: true # Caches the Unity installation between workflow runs
- run: | echo "Step Outputs:" echo "steps.unity-setup.unity-hub-path: '${{ steps.unity-setup.outputs.unity-hub-path }}'" echo "steps.unity-setup.unity-editors: '${{ steps.unity-setup.outputs.unity-editors }}'" echo "steps.unity-setup.unity-editor-path: '${{ steps.unity-setup.outputs.unity-editor-path }}'" echo "steps.unity-setup.unity-project-path: '${{ steps.unity-setup.outputs.unity-project-path }}'" echo "Environment Variables:" echo "UNITY_HUB_PATH: '${{ env.UNITY_HUB_PATH }}'" echo "UNITY_EDITORS: '${{ env.UNITY_EDITORS }}'" echo "UNITY_EDITOR_PATH: '${{ env.UNITY_EDITOR_PATH }}'" echo "UNITY_PROJECT_PATH: '${{ env.UNITY_PROJECT_PATH }}'"

inputs

namedescriptionrequired
version-fileSpecify a path to search for the unity project version text file. Useful if there are multiple projects in a single repo. Pass None if creating a new project to skip file search.false
unity-versionSpecify the Unity version(s) to install. example: 2019.4.13f1 (518737b1de84). This will override any version specified in the version-file!false
build-targetsSpecify the build targets to install for. Remaps to corresponding module. One or more of StandaloneWindows64WSAPlayerStandaloneOSXiOSStandaloneLinux64AndroidLuminWebGLVisionOS.false
modulesModules to install with the editor. This list can be different per editor version.false
architectureSpecify the architecture to install. Either x86_64 or arm64.false
install-pathSpecify the path where Unity will be installed to.false
auto-update-hubAutomatically update Unity Hub to the latest version before installing Unity Editors. Can be true or false. Default is true.false
hub-versionSpecify a specific version of Unity Hub to install. Example: 3.12.0. When set, auto-update-hub is automatically disabled.false
cache-installationCache the Unity installation between workflow runs to speed up subsequent runs. Can be true or false. Default is false.false

Note

cache-installation does not apply to the Unity Hub installation, only to Unity Editor installations.

unity-version formats

Use any of the following patterns to control how the editor version is resolved:

  • Fully qualified: 2022.3.62f1 or 2019.4.40f1 (ffc62b691db5)
  • Major + minor: 6000.2 → latest stable in the 6000.2.x line
  • Major only: 6000 or 2022 → latest stable in that major (e.g., 6000.2.1f1, 2022.3.x)
  • Wildcards: 2021.3.x, 2022.3.*, 6000.0.x
  • Exact year+minor with trailing zero: 6000.0.0 confines selection to the 6000.0.x line

Note

  • If you want the latest across minors within a major, use just the major (e.g., 6000).
  • If you want to stay within a specific minor, use MAJOR.MINOR (e.g., 6000.2).
  • If you want to lock to the .0 minor, use 6000.0.0 or 6000.0.x.
  • Stable (f) releases are preferred unless you explicitly specify a pre-release (a/b/rc) version.

outputs

step outputs

Steps outputs available for use in subsequent steps:

Tip

prefix step outputs with the step id you set in your workflow. In the example above, the step id is unity-setup:

${{ steps.unity-setup.outputs.unity-hub-path }}

  • unity-hub-path: The file path to the Unity Hub installation.
  • unity-editors: A JSON array of all installed Unity Editors on the runner.
  • unity-editor-path: The path to the latest installed version of Unity.
  • unity-project-path: The file path to the Unity project.

environment variables

Environment variables available for use in subsequent steps:

Tip

prefix environment variables with env. when using in subsequent steps. For example:

${{ env.UNITY_HUB_PATH }}.

  • UNITY_HUB_PATH: The path to the installed unity hub.
  • UNITY_EDITORS: A JSON array of all installed Unity Editors on the runner.
  • UNITY_EDITOR_PATH: The path to the latest installed version of Unity.
  • UNITY_PROJECT_PATH: The path to the Unity project.

Releases

Used by

Contributors

Languages