Azure Mobile Services for Unity3d

State of play

If you’ve followed my previous Unity3d Azure tutorials I’ve covered two well known Unity Azure plugins - Prime31 and Bitrave. Bitrave had better multi-platform support, however it required the ‘JSON.NET’ paid asset to support iOS and Android. But then there was issues with iOS AOT compiler. Because of this I decided to start a new Azure Mobile Services library for Unity3d to support multi-platforms like Unity3d - iOS, Android and Windows without need for paid plugins.

Using Azure Mobile Services in Unity3d

You can drop the Unity3dAzure libraryinto your existing Unity project or try out the demo project to get started.

Getting started

  1. Download the Unity3d Azure demo project or use git to clone the project:

     git clone https://github.com/Unity3dAzure/MobileServicesDemo.git
    
  2. Create a Mobile Service

    • Create ‘Highscores’ table for app data
    • Modify ‘Highscores’ table Insert node script to save userId
    • Create a custom API called ‘hello’
  3. In Unity3d open scene Scenes/HighscoresDemo.unity

    • Check the Demo UI script is attached to the Camera. (The script can be attached by dragging & dropping the Scripts/HighscoresDemoUI.cs script unto the Scene’s ‘Main Camera’ in the Hierarchy panel.)
  4. Paste Azure Mobile Service app’s connection strings into Unity Editor Inspector fields (or else directly into script Scripts/HighscoresDemoUI.cs)

    • Mobile Service URL
    • Mobile Service Application Key
  5. If you want to save score with userId then create Facebook app

    • Fill in Azure Mobile Service’s Identity > Facebook settings (App Id & App Secret)
    • Paste Facebook access user token into Unity Editor Inspector field (or else directly into Scripts/HighscoresDemoUI.cs)
      Play in UnityEditor

Credits

Special thanks to Jason Fox and Bret Bentzinger who put together the UnityRestClient library using the JsonFX plugin.