For some time now, prime[31] has been an industry leader in platform specific extensions for Unity games. Many of these extensions allow developers to tie their Unity games with the native functionality of a platform. In the case of Windows 8 and Windows Phone, they include services such as the Microsoft Advertising SDK, Social network sharing, trials and in-app purchases, and of course Azure, which this tutorial will cover.

A big check mark in the plus column for Microsoft platforms is the fact that most of the Microsoft based plugins for Windows Phone and Windows 8 are free, due to our partnership. You can find them all here.

// Prepares the connection to the Azure servers. This must be called before any other methods.publicstaticvoidconnect(stringapplicationUrl,stringapplicationKey)// Inserts a new item into the databasepublicstaticvoidinsert<T>(Titem,ActioncompletionHandler)// Updates an item in the databasepublicstaticvoidupdate<T>(Titem,ActioncompletionHandler)// Deletes an item from the databasepublicstaticvoiddelete<T>(Titem,ActioncompletionHandler)// Queries the databasepublicstaticvoidwhere<T>(Expression<Func<T,bool>>predicate,Action<List<T>>completionHandler)// Looks an item up to see if it is in the databasepublicstaticvoidlookup<T>(Titem,Action<T>completionHandler)// Authenticates a user with the service provider. Note that the service provider must first be setup in the Azure web dashboard! The completionHandler// will return null in the event of a login failure.publicstaticvoidauthenticateWithServiceProvider(MobileServiceAuthenticationProviderserviceProvider,Action<MobileServiceUser>completionHandler)

It’s important to note that before you can use this plugin you must download and install the Mobile Services SDK from here.

Usages for Azure and BizSpark

Azure allows developers to tie into the cloud and take full advantage of all of the cloud. Personally, I use it for hosting my sites and HTML5 based games, as well as leaderboards for Unity games. Larger studios, such as Turn 10, who recently released Forza 5 on Xbox One, use Azure for crunching physics calculations in real time, as well as the drivatars for racing against friends when they aren’t actually online. I’ve also seen people use the cloud for simple tasks like acquiring a static IP or batch crunching images through a virtual machine, rather than rely on your PC to handle it. If you don’t have Azure already, you can sign up for a free trial. If you are a startup or budding developer, reach out to me and I can set you up with BizSpark, which is completely free and offers you:

Don’t worry about the cost if you’re a startup – we can help you with that, and many of the smaller studios I work with don’t foot the bill at all. If you are completely new to Azure, then I’d suggest starting here at our educational center, which is how I learned. The Microsoft Azure Educator Grantprogram provides educators Microsoft Azure for use in their University curricula as well. (5 months).

Azure Mobile Services

Azure Mobile Services has a free tier that includes up to 500 devices and 500k API calls, and additionally, you can also use the free tier for up to 10 services. When I first got started with Mobile Services, I had no idea of what I was doing. Fortunately, Scott Guthrie has a great 10 minute video, where he gives a high-level overview of Azure Mobile Services. He also gives a great overview of what Mobile Servicesis, but here is the gist: Windows Azure Mobile Services makes it incredibly easy to connect a scalable cloud backend to your client and mobile applications. It allows you to easily store structured data in the cloud that can span both devices and users, integrate it with user authentication, as well as send out updates to clients via push notifications. That link also provides a great starting point for creating your first mobile service, so I won’t cover it here.

Downloading and installing the prime[31] Azure plugin

Start off by going to the plugins page and downloading the Azure Plugin. When you click on the download now button, it will prompt you for your name and e-mail. Fill out that form, and you’ll receive a link to download the plugin in your email moments later. Download the plugin and import it into your current Unity project by double-clicking on it. This will place a new folder with several items inside of your Plugins folder in Unity. Your structure will now look like this: Because this plugin was installed by hand, it will not appear in our prime[31] Plug tab. This tab generally manages the plugins you’ve installed, and can be found at the top of the Unity Editor, under the prime[31] pull-down.

MetroAzureTestScene

When you load the MetroAzureTestScene, you won’t see anything other than a blue background. Press play, and you’ll be greeted with four buttons. They won’t do anything just yet though, because we haven’t built our project for Windows 8. In order to see any kind of functionality, we’ll need to build the project, and run it from Visual Studio.

Preparing your Build for prime[31] plugins

We’re not quite finished yet. Go to File --> Build Settings, located at the top-right corner of Unity. Make sure that your Inspector window is visible, because we’re going to change some build settings for Windows 8 here. You'll want to add the current scene to the build as well. While your MetroAzureTestScene is loaded, click on the Add Current button, and you'll see the path to the scene appear in your build settings. The checked box signifies that it will be included. Click on Windows Store Apps, and on the right-hand side you will see several options. prime[31] currently only supports C# / XMAL apps, so under Type you must select XAML C# solution. For SDK, I’m currently building for Windows 8, and I have Unity C# projects checked. Select the button for Player Settings, and look at your Inspector window. You should see a tab for Publishing Settings; select that. Move down to Unprocessed Plugins, and you’ll see that the size currently reads 0. Change that to 1, and a new line appears, with the text Element 0 to the left of it. This is a key bit of information missing from the prime[31] documentation, and I spent 2 days troubleshooting the issue! This thread illustrates the issue, and the resolution. You need to add "P31MetroAzure.dll" in this empty field, otherwise Unity never knows to build the project with your Azure plug. Without that, you’ll receive this error when you try to build:

With that out of the way, go back to the Build Settings popup, and select Build. When it prompts you for a location, I generally create a new folder inside of my project called “Builds”, and then have more folders inside of that one for each platform. In this case, “Metro”. You’ll see a command prompt appear, and your game will build itself in the background.