Press "Enter" to skip to content

Month: September 2016

Share your Unity game’s URL every build!

As a game developer I want to share my current game quickly with friends and testers. As going to the build page, clicking the share-link and then updating a webpage is a lot of work, I went looking for other ways.

Luckily Unity Build has an API. It also has a webhook to notify when the build is completed. Putting these all together, my website buttons now automatically link to the latest build on the Unity Build platform. Unfortunately I spent a lot of item trying to figure out what parameters were the correct ones, which took more time than which I had hoped. For that reason, please find the references in step 4.

Requirements

  • A webserver with php installed (MySQL optional)
  • A Unity cloud build project with automated builds set-up

 

 

  1. Go to your webserver and create 2 files: webhook.php and index.php
  2. Open webhook.php and paste in the following code (explanation will follow)

     
  3. Paste the following code in index.php
  4. Now we can look up the required information:
    1. Your api-key can be found in your cloud build > Preferences > API-key
      apiKey
    2. Your organisation, project and build id’s can be found by making the following API get-request

      From there you can find all the required ids from above (per project).
    3. Your build target is the name of your target system in small letters (eg. webgl)
  5. Now it is time to set up the actual webhooks. Go to the notifications tab of your cloud build project and choose “Add new”. Fill in the URL of your php script on your web server and keep the json content type.  Click the check boxes so only “ProjectBuildSuccess” remains and use SSL only if your site has https.
    newWebhook

 

After filling everything in, start a new build (or commit a change). The cloud should send a post message to your website and the URL in the text file will be updated. When you go to your index.php page, you will be redirected to the build of your game’s latest commit!

Leave a Comment

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close