prime[31] Azure plugin for Win Phone 8 Unity games

Prime31In my previous tutorial series, I wrote about how to use prime[31]’s Azure plugin to connect your Win8 Unity game. Recently though, they’ve added support for Windows Phone as well. I’ve updated the GitHub Repository  with the necessary changes so that it works on both platforms.’

Download the file

You only need to make a few changes to your project to get this going. Start by downloading the necessary files for the Win Phone version of the plugin.You can find the files at this page. Click on the Windows Phone button, and scroll down to the bottom of the page, and look for “Microsoft Azure Plugin”.

 

Store-Page

 

Download the Unity package, and add the following files to your current prime[31] project:

prime-31-win-phone-files

 

Editing the MetroAzureDemoUI.cs file

Open MetroAzureDemoUI.cs, which can be found in your /scripts folder. Right now our project is using the Prime31.MetroAzure namespace.We want to comment that out, and add the Prime31.WinphoneAzure namespace instead!

The file are slightly different, although they have a number of redundant functions names, so this can throw the project through a loop, as it isn’t sure of which version of the azure functions you want to use, because both are currently there.

win-phone-prime-31-script

 

That’s the only change we need to make to the file!

 Building the project for Win Phone

Back in Unity, build the scene, but target Windows Phone, instead of Windows 8.

Phone-Build-1

 

Running the project from Visual Studio

Those are the only changes you need to make. From there open the solution you just created inside of your build folder.

Win-Phone-Azure-Unity-build

 

Wth Visual Studio open, you can either deploy to the simulator, or plug in your developer phone and deploy directly to that. That”s the approach I took in this tutorial — connected my phone via USB, and deployed the project to my phone, by targeting it through the debug menu.

VS-Win-Phone-Build

I hit deploy, and it was running on my phone!

Win-Phone-Unity-build

 

Let’s quickly recap the steps:

  1.  Download the Win Phone plugin from prime31
  2. Add the files to your current project
  3. Change the namespace so that it included Prime31.WinPhoneAzure
  4. Build for Windows Phone
  5. Deploy to the simulator or developer phone

 

Additional Notes

If you try to go back to making this a Win8 project, and build that, you’ll come across an issue when you go to deploy the project from Visual Studio. For some reason, the WIndows Phone .dll injects this line of code in the Windows 8 project:

Prime31.MetroHelpers.UIHelper.initialize( ( action ) => appCallbacks.InvokeOnAppThread( () => action(), false ) );

That Initialize function doesn’t accept any parameters, so I don’t know why the lambda is placed in there.

I just comment out that line, and replace it with this:

 

Prime31.MetroHelpers.UIHelper.initialize();

Win-8-Azure-Plugin-Coment

Resources:

 

-----------------------


subscribe-to-youtube

One thought on “prime[31] Azure plugin for Win Phone 8 Unity games

  1. Pingback: prime[31] Azure plugin for Win8 Phone Unity games - Dave Voyles for Gaming, HTML5, Startups, & Xbox - Site Home - MSDN Blogs

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.