Skip to content

RageAgainstThePixel/com.utilities.buildpipeine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

com.utilities.buildpipeline

Discord openupm openupm marketplace

A Build Pipeline utility package for the Unity Game Engine.

Installing

Requires Unity 2019.4 LTS or higher.

The recommended installation method is though the unity package manager and OpenUPM.

Via Unity Package Manager and OpenUPM

  • Open your Unity project settings
  • Add the OpenUPM package registry:
    • Name: OpenUPM
    • URL: https://package.openupm.com
    • Scope(s):
      • com.utilities

scoped-registries

  • Open the Unity Package Manager window
  • Change the Registry from Unity to My Registries
  • Add the Utilities.BuildPipeline package

Via Unity Package Manager and Git url

  • Open your Unity Package Manager
  • Add package from git url: https://github.com/RageAgainstThePixel/com.utilities.buildpipeine.git#upm

Documentation

This package is designed to be use in conjunction with a CI/CD pipeline, such as marketplace.

Example Usage

Create Github Action Workflow

  1. Create a new action workflow file using marketplace .github/workflows/unity-build.yml

  2. Add the following content to the file:

name: unity-build

on:
  push:
    branches:
      - 'main'
  pull_request:
    branches:
      - '*'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      # max-parallel: 2 # Use this if you're activating pro license with matrix
      matrix:
        include:
          - os: windows-latest
            build-target: StandaloneWindows64
          - os: macos-latest
            build-target: StandaloneOSX
          - os: ubuntu-latest
            build-target: StandaloneLinux64

    steps:
      - uses: actions/checkout@v4

        # Installs the Unity Editor based on your project version text file
        # sets -> env.UNITY_EDITOR_PATH
        # sets -> env.UNITY_PROJECT_PATH
        # https://github.com/XRTK/unity-setup
      - uses: xrtk/unity-setup@v7
        with:
          modules: ${{ matrix.build-target }}

        # Activates the installation with the provided credentials
        # https://github.com/XRTK/activate-unity-license
      - uses: xrtk/activate-unity-license@v5
        with:
          # Required
          username: ${{ secrets.UNITY_USERNAME }}
          password: ${{ secrets.UNITY_PASSWORD }}
          # Optional
          license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
          auth-key: ${{ secrets.UNITY_2FA_KEY }} # Required for personal activations
          # serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations

      - name: Unity Build (${{ matrix.build-target }})
        uses: RageAgainstThePixel/unity-build@v7
        with:
          build-target: ${{ matrix.build-target }}

Executable Methods

These methods can be executed using the -executeMethod command line argument to validate, sync, and build the Unity project.

Method Description
Utilities.Editor.BuildPipeline.Validate Validates the Unity Project assets by forcing a symbolic link sync and creates solution files.
Utilities.Editor.BuildPipeline.SyncSolution Force Unity to update CSProj files and generates solution.
Utilities.Editor.BuildPipeline.StartCommandLineBuild Start a build using command line arguments.
"/path/to/Unity.exe" -projectPath "/path/to/unity/project/" -quit -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild

Additional Custom Command Line Arguments

In addition to any already defined Unity Editor command line arguments, this plugin offers some additional options:

Argument Description
-ignoreCompilerErrors Disables logging.
-autoIncrement Enables auto incrementing.
-versionName Sets the version of the application. Value must be string.
-versionCode Sets the version code of the application. Value must be an integer.
-bundleIdentifier Sets the bundle identifier of the application.
-sceneList Sets the scenes of the application, list as CSV.
-sceneListFile Sets the scenes of the application, list as JSON.
-buildOutputDirectory Sets the output directory for the build.
-acceptExternalModificationsToPlayer Sets the build options to accept external modifications to the player.
-development Sets the build options to build a development build of the player.
-colorSpace Sets the color space of the application, if the provided color space string is a valid ColorSpace enum value.
-buildConfiguration Sets the build configuration of the application. Can be: debug, master, or release.
-export Creates a native code project for the target platform.
-symlinkSources Enables the use of symbolic links for the sources.
-disableDebugging ⚠️ deprecated. Use allowDebugging. Disables the ability to attach remote debuggers to the player.
-allowDebugging Enables or disables the ability to attache a remote debugger to the player. Can be: true or false.
-dotnetApiCompatibilityLevel Sets the dotnet api compatibility level of the player. Can be: NET_2_0, NET_2_0_Subset, NET_4_6, NET_Unity_4_8, NET_Web, NET_Micro, NET_Standard, or NET_Standard_2_0.
-scriptingBackend Sets the scripting framework of the player. Can be: Mono2x, IL2CPP, or WinRTDotNET.
-autoConnectProfiler Start the player with a connection to the profiler.
-buildWithDeepProfilingSupport Enables deep profiling support in the player.

Platform specific Command Line Arguments

Android Command Line Arguments
Argument Description
-splitBinary Builds an APK per CPU architecture.
-splitApk Uses APK expansion files.
-keyaliasPass Sets the key alias password.
-keystorePass Sets the keystore password.
-symbols Sets the symbol creation mode. Can be: public, debugging, or disabled.
MacOS COmmand Line Arguments
Argument Description
-arch Sets the build architecture. Can be: x64, arm64, or x64arm64.

Project Validation Command Line Arguments

Argument Description
-importTMProEssentialsAsset Imports the TMPro Essential assets if they are not already in the project.