This second stage of or Git to Steam journey will leads us to connect Unity with the the Bitbucket system (where everything begin).
Unity Cloud Build (or UCB) allows you build your Unity project automatically on servers in the Unity cloud.
This is very usefull for many reasons:
- it doesn’t use your in house resources
- it is included in an already subscribed Unity licences (such as Unity Plus or higher or Unity Teams)
- it is always available
- it is directly on the cloud (means that the bandwidth is not an issue)
- the build are always build the same way
We will here follow the step to setup this tools to accept the change coming from our versioning tool: Bitbucket.
You must have:
- an Unity account with Plus, Pro or Team licence
First of all, we must declare our project inside the Unity Cloud website.
Click on the Unity Cloud Build service:
Create a new project (or use an existing one if you already have one):
Let’s call it Death Star:
Go back to the Home page and select back the Unity Cloud Build project. You project should now appear in the list. Select it.
Once done, you will be redirected to the Unity Cloud Build dashboard. From here we can setup the build configuration we will need for our process.
Now the setup of the project is done, let’s gather some information that will be useful for the next steps.
Go to the Settings page (on the left menu).
Note here the API key of your project, we will use it later. For this example: a6a5fa03a9b8711code66cd467836a4
Then look at the the URL:
Note here several data:
– Organization ID: 4815162342 for this example
– Project ID: 3283627-c3po-r2d2-bb8-tk421 for this example
Target build configuration
A target build is a list of parameters that Unity will use each time it will receive the order to build the application from the source. As we want to automatize the task, select “Set up cloud build”:
Select Manual (for unknown reasons the standard one did not work for us).
Then type the Git URL identified during the previous step. For our example project:
- darthvader is your GIT username
- empire is your tenant address
- deathstar.git is your project .git file
Click on Next Access:
We now need to use the SSH private key generated to allow Unity Cloud Build to connect to your source control system. Let’s see what we need to do:
First copy the SSH key above. Then connect to your Bitbucket account and add this key to your private key list.
Select the OS for this first build target. Le’ts choose Windows desktop 64-bit for this first one:
Fill up the fields with the following information:
<BRANCHNAME> - <OSBUILD>
where <BRANCHNAME> is the name of your git branch and <OSBUILD> the name of the OS.
It is very important to respect the name of your GIT branch because the final script will check this value.
Select the branch available in your GIT repository
We suggest to match the one you use to develop your game in order to avoid any surprise.
Auto build and Auto Cancel
Let them enabled
Click on Build. You’ll be redirected to the build summary page. You can here that your first build is started. You can wait until it’s done or cancel it. We’ll come back here later.
Others target build
Redo the previous process for each OS and each GIT branch you have. You should end with something like this:
We can now test our build.
Click on Build History in the left menu. Then click on the Build: Multiple Targets button.
Select the builds you want to test then click on Build:
Your build will be added in your queue and you can follow their status like this:
Once you are sure that all your builds works perfectly, you can proceed to the next step. However analyze the errors and fix them.
Cleanup the terminated build (very important) after this step by clicking on the three dots of the build then select Delete build:
We now have a fully operational Unity Cloud Build environment for our automatic build process with build targets.
You gathered and noted the following information:
– The API key that will be used by the bash script to connect to Unity Cloud Build. For this example: a6a5fa03a9b8711code66cd467836a4
– The Organization ID: 4815162342 for this example
– The Project ID: 3283627-c3po-r2d2-bb8-tk421 for this example