In order to get Unity Cloud Build to automatically trigger builds you'll need to connect it to your bitbucket project. We'll go over how to do this and setup a default WebGL build of our sample game.
- [Voiceover] Now it's time for us to create a Unity Cloud Build project from our Bitbucket project. In order to do this, let's go to the Unity Cloud Build site and log in. You'll the option to create a new project. Here we'll give the project a name we'll call it SuperZombieRunner and we'll choose an organization by default, our username is the first option. Here I'll select JesseFreemanDemo which is the name of the account I set this up with.
Now let's click create. Now in order for us to use Unity Cloud Build we're going to need to connect it to our source control Repo. Let's go back over to Bitbucket and on the homepage of our project let's copy the URL and paste it into the server URL field. Next, we'll need to select get from the drop down menu and click next for access. At this point, this is the first time we're connecting our Cloud Build to our Bitbucket account we're going to need to add an SSH key.
Unity Cloud Build will automatically generate this key for us. Simply copy the contents of the key go back into Bitbucket, and add Unity Cloud Build to the SSH key list. I'll make the label say Unity Cloud Build and we'll paste in the SSH key. Now let's click add, and we should be able to link the two together.
Once you've done that, go back to Unity Cloud Build and click next to set up our first target build. Now that everything's connected we're able to begin doing a build. In order to do this, we need to choose a platform for our project to get built on. As you can see, Unity Cloud Build supports all of the major platforms that Unity itself does. The firs time you set up an account you'll only be able to set up one build by default.
For now, let's focus on a WebGL build since it will be the easiest for us to test. Select WebGL, and now we'll have to set up all the options. First, you'll see we choose the platform which is automatically set up for us as WebGL. Next, we can give it a label, so we can help find it and make it easier to organize then we're going to need to define the branch that our code is living in.
Let's click on the select branch option and pick master. Since we don't have any other branches this is where we'll always look. Unity Cloud Build will automatically monitor this branch, and whenever it detects a change, it will immediately start doing a build. Later on, I'll talk about creating different branches, as we add more code and make changes to our project. In all of my own projects, I always have Unity Cloud Build look at the master. Whenever I make changes, or add new code to my project, I usually do it in a separate branch and then merge those changes into master and then push them back to Bitbucket.
Let's select okay. After that you can choose a project subfolder If your project is complex and you have many different folders. Then you can choose the Unity version here I'm going to leave it at default so that it says always use the latest 5.X build and we'll leave Auto-build on. This means that whenever Unity Cloud Build detects a change in the Repo, it will automatically do a build for you. Let's click next and start the build.
At this point, our build has been configured and is now in the queue waiting to get activated. Once it's activated, you'll see that the status changes and now it will give you the duration, counting down how long it takes to do a build. This can vary depending on your plan, and also the amount of traffic that Unity Cloud Build has. Sometimes, a WebGL build can take 20 minutes or sometimes it can take an hour. Also, every time you trigger a build there's a delay between each build based on your plan.
Right now I'm going to let this run, and then once this is done building we'll pick back up again, and talk about what actually happened.
- Setting up Unity Cloud Build, Bitbucket, and Git
- Creating a .gitignore file
- Committing and pushing changes
- Connecting to Unity Cloud Build
- Creating new Unity Cloud Build targets
- Merging project changes
- Optimizing a Unity Cloud Build workflow