In 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”.
Download the Unity package, and add the following files to your current prime[31] project:
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.
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.
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.
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.
I hit deploy, and it was running on my phone!
Let’s quickly recap the steps:
- Download the Win Phone plugin from prime31
- Add the files to your current project
- Change the namespace so that it included Prime31.WinPhoneAzure
- Build for Windows Phone
- 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();
Resources:
-----------------------
@DaveVoyles
Pingback: prime[31] Azure plugin for Win8 Phone Unity games - Dave Voyles for Gaming, HTML5, Startups, & Xbox - Site Home - MSDN Blogs