Categories
Uncategorized

Electric Pipelines Demo

Introduction

Unity has a reputation for being a beginner friendly engine. It does a lot of things out of the box for you. Building and deploying your app is pretty simple if you’re a solo dev just trying to get your game onto a device. However, Unity doesn’t make it easy to set up more professional build and deployment workflows, like multi-platform builds, command line building, or CI/CD pipelines. Here you will find a demo of the tooling that Electric Pipelines can set up to make your builds easier. We offer hand crafted dev ops for game companies.

This demo can be found in video form.

Setup

For this demo, we have a Unity game. We will be deploying it Android, and building the backend server on Linux and Windows. We will be building and deploying these both manually in the editor and through a build pipeline we’ve set up on Jenkins.

Manual Builds

For multiplatform games, Unity require you to switch configuration before you build another platform. This eats up a lot of time for larger projects.

An example of waiting around for configuration switching

To get around that, you can write your own scripts to build your project for different configurations. We have set up scripts to build each individual platform, and a few for combinations.

An example of a build script

Now, you can use menu options in the editor to build each individual platform.

The build option that we added can be used from the editor.

Building from the command line

Unity lets you do almost anything you can do in the editor from the command line. There is a catch: you have to write scripts for all of it. With the scripts we set up earlier, we can build our game from the command line. In the example below, we will call Unity from the command line and tell it to run our build method, BuildPlayerExample.AndroidBuild, on the project found in the folder BomberPrototypeUnity. You can find the full documentation on Unity command line builds here.

An example of building from the command line. Underlined is the call to the specific method (Android Build) we wrote earlier.

CI/CD pipeline in Jenkins tour

Now that we have command line building working, we have all of the tools we need for setting up a CI/CI pipeline.
We’ve set up a CI/CD pipeline in Jenkins that can build each platform. Jenkins will set up build agents that will use something similar to the command line option above to build on each platform.

Jenkins dashboard

We can trigger builds for each platform using git tags. You can tag each commit in git with different build actions. In the example below, you can see that we’ve tagged our commits to build Android, Linux, Windows, Headless servers, and iOS. You have a lot of flexibilty on what platforms you build and how long your build is going to take.

Jenkins dashboard showing different tagged builds
Example of how you tag a commit pt 1
Example of how you tag a commit pt 2

Once you kick off a build, you can track the build progress in Jenkins. In this demo, we set up a build that would publish to AppCenter at the end, so that beta-testers would have access.

Jenkins build in progress
After the build is complete, it gets pushed to beta testers using AppCenter


Leave a Reply

Your email address will not be published. Required fields are marked *