SlideShare una empresa de Scribd logo
1 de 72
• Intro to prime[31]’s Azure plugin 
• Creating a mobile service in the Azure web portal 
• Installing the plugin 
• How does Unity handle .DLLs? 
• Compiling our project 
• Walking through the code 
• Azure functions 
• What other options exist? 
Source Code: https://github.com/DaveVoyles/prime31-azure
prime 
• Free! 
• Runs across: 
Windows 8 Store 
Windows Phone 8 
Does not run in the Unity Editor 
• Download here: 
https://prime31.com/plugins#
// Prepares the connection to the Azure servers. This must be called before 
any other methods. 
public static void connect( string applicationUrl, string applicationKey ) 
// Inserts a new item into the database 
public static void insert<T>( T item, Action completionHandler ) 
// Updates an item in the database 
public static void update<T>( T item, Action completionHandler ) 
// Deletes an item from the database 
public static void delete<T>( T item, Action completionHandler )
// Queries the database 
public static void where<T>( Expression<Func<T,bool>> predicate, 
Action<List<T>> completionHandler ) 
// Looks an item up to see if it is in the database 
public static void lookup<T>( T item, 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. 
public static void authenticateWithServiceProvider( 
MobileServiceAuthenticationProvider serviceProvider, 
Action<MobileServiceUser> completionHandler )
prime 
NOTE: It’s important to note that before you can use this plugin you 
must download and install the Mobile Services SDK from here.
Creating your mobile service 
https://manage.windowsazure.com/
Creating your mobile service
Creating your mobile service
Creating your mobile service
Creating your mobile service
Creating your mobile service
Creating your mobile service
Creating your mobile service
Creating your mobile service
Creating your mobile service
What is a .DLL? 
A DLL is a dynamic link library. It is a 
collection of code and/or data, which 
may be used by several applications 
(or other libraries/modules). 
So, common methods to process 
files, work with GUI components etc. 
are made available in libraries so 
several applications may use the 
same functionality.
Handling .DLLs 
For example: 
Assets/Plugins/Metro 
would hold my [prime31] .DLL which 
connects to Azure.
Building .DLLs 
When Unity builds your project, it 
first grabs all of the .DLLs within 
the Assets/Plugins folder. 
It then does another pass to see if 
there is a platform-specific folder 
containing plugins.
Is one present? 
If one is present, it adds those to the 
build. 
If there are two plugins with the 
same name: 
1. Unity prioritizes the plugin in the 
platform-specific folder, and 
2. overwrites whatever was in 
the Assets/Plugins folder.
Installing the plugin 
Download the plugin from the prime[31] site by 
registering at the site. 
You’ll receive a download code immediately after, in 
your e-mail.
Installing the plugin 
Import the whole project into an 
empty Unity scene
Go to File –> Build Settings, located 
at the top-right corner of Unity. 
NOTE: Make sure that your Inspector 
window is visible, because we’re 
going to change some build settings 
for Windows 8 here! 
Add the current scene 
(MetroAzureTestScene) to the build.
Click on Windows Store Apps, and 
on the right-hand side you will see 
several options. 
NOTE: 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.
NOTE: You need to add “P31MetroAzure.dll” in 
this empty field, otherwise Unity never knows to 
build the project with your Azure plug!
You’ll also need to add “Internet Client” to your 
capabilities section. 
This allows your Win8 project to connect to the 
internet. It modifies the AppManifest.XML file 
which is generated for your WIn8 project.
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”.
Something that threw 
me in a loop initially, 
was the fact that the 
project wants to deploy 
to an ARM device 
immediately. 
If you hit debug “Local 
Machine” it will throw an 
error about your 
machine not being an 
ARM tablet.
Go to Configuration 
Manager and change 
the Active Solution 
Platform to X86
You can now run your 
projects and deploy 
them via Visual Studio. 
Do that, and you will be 
greeted with this screen:
NOTE: On occasion, I’ll get an error when building the project. 
I’m not sure of what causes this, but when I switch my deployment from 
whatever it is currently on (for example, Debug) to Release or Master, it 
suddenly builds fine. 
I can then go back to Debug, and use that if I’d like.
A container for the things 
you insert into your 
leaderboard. 
It simply holds a name, 
score, and unique ID for 
each object you insert into 
the board. 
NOTE: username and score 
MUST be lowercase
[SerializeField] private string _azureEndPoint = "<your leaderboard service>"; 
[SerializeField] private string _applicationKey = "<your application key>";
Organizes 
our 
buttons 
and on-screen 
text.
We can update, delete, and insert things into our 
leaderboard, but before we can update or delete anything, we 
need to return some leaderboard results. 
The syntax may look kind of funky, but bear with me:
// Grab all scores in our leaderboard which are <= _minScoreToReturn 
Azure.where<LeaderBoard>(i => i.score <= _minScoreToReturn, itemsInTheLeaderboard => 
{ 
Debug.Log("queried all scores <= 100 has completed with _leadersList count: 
" + " " + itemsInTheLeaderboard.Count); 
_leadersList = itemsInTheLeaderboard; 
// Loop through each item in the leaderboard list, and draw it to the log 
foreach (var item in itemsInTheLeaderboard) 
{ 
GUILayout.Label("Name:" + " " + item.username + " " + "Score" + " " + item.score); 
} 
});
We use a lambda function as the first parameter, which serves 
as an anonymous (unnamed) function. 
i is as each object in our leaderboard list, and we are looking 
to pull out the scores, so the argument within this lambda 
function is i.score.
Azure.where<LeaderBoard>(i => i.score <= 
_minScoreToReturn,
The next parameter in our Azure.Where() function 
is itemsInTheLeaderBoard 
You know those items we just returned from our leaderboard? 
Well they all get stored in this variable, which serves as list 
that we can now manipulate. 
itemsInTheLeaderboard =>
I’m not quite sure if I’ve been able to return anything at this 
point though, so why not draw it to our log, just to be sure? 
First we take the itemsInTheLeaderboard, and use the count() 
function (given to us by the fact that this is of type List), and 
verify that we have some things being returned. 
Debug.Log("queried all scores <= 100 has completed with 
_leadersList count: " + " " + itemsInTheLeaderboard.Count);
Next, we need to loop through each leaderboard item in this 
list and draw it to the screen, because what’s the point of 
having a leaderboard if folks can’t see how they compare to 
everyone else, right? 
Using a foreach loop, we iterate through each item in the 
leaderboard ad draw it to the screen, including the username 
and score.
// Loop through each item in the leaderboard list, and draw it to the log 
foreach (var item in itemsInTheLeaderboard) 
{ 
GUILayout.Label("Name:" + " " + item.username + " " + "Score“ 
+ " “ + item.score); 
}
NOTE: You MUST use lowercase values for username and 
score. You’ll see in our leaderboard class that I even use 
lowercase values. 
That’s because the node.js backend we are using on our 
Azure leaderboard is expecting lowercase values.
NOTE: All of the functions in this sample require you to be 
connected to Azure before you do anything. 
You must hit the “Connect Azure Service” before anything can 
take place!
if (GUILayout.Button("Insert To Leaderboard")) 
{ 
Azure.insert(_leaderBoardItem, 
() => Debug.Log("inserted" + " " 
+ _leaderBoardItem.username + " " + 
"to leaderboard")); 
}
I’ve entered “Unity Tutorial Test” as the user name and “70″ as 
the score for the inputs. 
Hit “Insert To Leaderboard” AFTER you connect, and you’ll be 
good to go!
To update or Delete an item in the leaderboard, we need to 
perform a few steps: 
1. Connect to the Azure Mobile Service 
2. Retrieve results from the leaderboard 
3. The Update & Delete buttons will now appear on screen, 
beneath the newly returned results. 
4. Grab the latest results from the array in the leaderboard
// UPDATE the first (latest) thing in the leaderboard 
if (GUILayout.Button("Update latest Item")) 
{ 
// Grab the first item in the leaderboard list 
var leaderToUpdate = _leadersList[0]; 
// Set the item's UserName to what we entered in the UserName input field 
leaderToUpdate.UserName = GUILayout.TextField(_leaderBoardItem.UserName); 
// Update the item in the leaderboard 
Azure.update(leaderToUpdate, 
() => Debug.Log("Updated leaderboard item:" + " " 
+ leaderToUpdate.UserName)); 
}
// REMOVE the first (latest) thing in the leaderboard (then delete it later) 
if (GUILayout.Button("DELETE LATEST ITEM")) 
{ 
// Grab the first item in the list 
var leaderToRemove = _leadersList[0]; 
// Removes item at the specified index 
_leadersList.RemoveAt(0); 
// DELETE it from the leaderboard 
Azure.delete(leaderToRemove, 
() => Debug.Log("Deleted latest item from leaderboard:" + " " + 
leaderToRemove.UserName)); 
}
So after we've returned our results, and the update button 
appears do the following: 
1. Enter a new name (for example, Johnny Quest) 
2. Hit the "Update Latest Item" button 
Now you'll see top item in the leaderboard list says Johnny 
Quest. Head to your Azure portal just to verify, and you'll see 
that it works!
What other options exist?
rave overview 
• Free! 
• Requires Newtonsoft.Json 
• Same project works on Win8 & WP8 
• Runs across: 
UnityEditor 
Windows 8 Store 
Windows Phone 8 
iOS 
Android 
Probably everything else Unity runs on
rave 
• http://www.bitrave.com/azure-mobile-services-for-unity-3d/ 
• www.DaveVoyles.azurewebsites.net 
• http://www.parentelement.com/assets/json_net_unity
Json.NET Unity Plugin 
NOTE: You will need the $20 Jon.NET Unity plugin to serialize the 
JSON data if you are running bitrave on non-Microsoft 
platforms. 
Microsoft platforms can use the Newtonsoft.JSON nuget 
package (download it from within the nuget package manager 
Visual studio), which is a free .DLL that is referenced from within 
your Visual Studio project.
rave vs. prime[31] 
• More platforms 
• Both free
• What are Azure Mobile Services? 
• Creating a mobile service in the web portal OR Visual Studio 
• Compiling our project – exclude .DLLs! 
• Other Options – bitrave 
Source Code: https://github.com/DaveVoyles/prime31-azure
@DaveVoyles 
DavidVoyles.wordpress.com

Más contenido relacionado

La actualidad más candente

SwiftUI - Performance and Memory Management
SwiftUI - Performance and Memory ManagementSwiftUI - Performance and Memory Management
SwiftUI - Performance and Memory ManagementWannitaTolaema
 
Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Yudep Apoi
 
Refreshing Your App in iOS 7
Refreshing Your App in iOS 7Refreshing Your App in iOS 7
Refreshing Your App in iOS 7Aviary
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJordan Open Source Association
 
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 Cutting edge HTML5 API you can use today (by Bohdan Rusinka) Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)Binary Studio
 
JQUERY TUTORIALS
JQUERY TUTORIALSJQUERY TUTORIALS
JQUERY TUTORIALSMoize Roxas
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016Mike Nakhimovich
 
The 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to KnowThe 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to KnowDaniel Dughila
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidgetKrazy Koder
 
React Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationReact Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationKobkrit Viriyayudhakorn
 

La actualidad más candente (20)

Groovymag_May-2012
Groovymag_May-2012Groovymag_May-2012
Groovymag_May-2012
 
SwiftUI - Performance and Memory Management
SwiftUI - Performance and Memory ManagementSwiftUI - Performance and Memory Management
SwiftUI - Performance and Memory Management
 
Active x
Active xActive x
Active x
 
Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008Steps how to create active x using visual studio 2008
Steps how to create active x using visual studio 2008
 
Refreshing Your App in iOS 7
Refreshing Your App in iOS 7Refreshing Your App in iOS 7
Refreshing Your App in iOS 7
 
JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and ReduxJOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and Redux
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best Practices
 
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 Cutting edge HTML5 API you can use today (by Bohdan Rusinka) Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 
Developing on Windows 8
Developing on Windows 8Developing on Windows 8
Developing on Windows 8
 
Android dev tips
Android dev tipsAndroid dev tips
Android dev tips
 
JQUERY TUTORIALS
JQUERY TUTORIALSJQUERY TUTORIALS
JQUERY TUTORIALS
 
WWDC18 share
WWDC18 shareWWDC18 share
WWDC18 share
 
Web works hol
Web works holWeb works hol
Web works hol
 
Sword fighting with Dagger GDG-NYC Jan 2016
 Sword fighting with Dagger GDG-NYC Jan 2016 Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
 
The 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to KnowThe 4 Layers of Single Page Applications You Need to Know
The 4 Layers of Single Page Applications You Need to Know
 
Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
 
Ngrx meta reducers
Ngrx meta reducersNgrx meta reducers
Ngrx meta reducers
 
React Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationReact Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + Authentication
 
React Native Firebase
React Native FirebaseReact Native Firebase
React Native Firebase
 
Google app engine
Google app engineGoogle app engine
Google app engine
 

Similar a Using prime[31] to connect your unity game to azure mobile services

Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersAmbarish Hazarnis
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxEqraKhattak
 
Creating a dot netnuke
Creating a dot netnukeCreating a dot netnuke
Creating a dot netnukeNguyễn Anh
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdfBOSC Tech Labs
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
Streamlining React Component Development and Sharing with bit.pptx
Streamlining React Component Development and Sharing with bit.pptxStreamlining React Component Development and Sharing with bit.pptx
Streamlining React Component Development and Sharing with bit.pptxShubhamJayswal6
 
intro_gui
intro_guiintro_gui
intro_guifilipb2
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NETPeter Gfader
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Mikkel Flindt Heisterberg
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupDavid Barreto
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
Introduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsIntroduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsKhademulBasher
 

Similar a Using prime[31] to connect your unity game to azure mobile services (20)

Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - Beginners
 
04 objective-c session 4
04  objective-c session 404  objective-c session 4
04 objective-c session 4
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptx
 
Creating a dot netnuke
Creating a dot netnukeCreating a dot netnuke
Creating a dot netnuke
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
Streamlining React Component Development and Sharing with bit.pptx
Streamlining React Component Development and Sharing with bit.pptxStreamlining React Component Development and Sharing with bit.pptx
Streamlining React Component Development and Sharing with bit.pptx
 
ID E's features
ID E's featuresID E's features
ID E's features
 
intro_gui
intro_guiintro_gui
intro_gui
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NET
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance Meetup
 
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
DotNetNuke
DotNetNukeDotNetNuke
DotNetNuke
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
UIAutomator
UIAutomatorUIAutomator
UIAutomator
 
Introduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsIntroduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET Controls
 

Más de David Voyles

Developing games for consoles as an indie in 2019
Developing games for consoles as an indie in 2019Developing games for consoles as an indie in 2019
Developing games for consoles as an indie in 2019David Voyles
 
Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019David Voyles
 
Overview Microsoft's ML & AI tools
Overview Microsoft's ML & AI toolsOverview Microsoft's ML & AI tools
Overview Microsoft's ML & AI toolsDavid Voyles
 
Intro to deep learning
Intro to deep learning Intro to deep learning
Intro to deep learning David Voyles
 
What is a Tech Evangelist?
What is a Tech Evangelist?What is a Tech Evangelist?
What is a Tech Evangelist?David Voyles
 
Microsoft on open source and security
Microsoft on open source and securityMicrosoft on open source and security
Microsoft on open source and securityDavid Voyles
 
Students: How to get started in the tech world
Students: How to get started in the tech worldStudents: How to get started in the tech world
Students: How to get started in the tech worldDavid Voyles
 
Students -- How to get started in the tech world
Students -- How to get started in the tech worldStudents -- How to get started in the tech world
Students -- How to get started in the tech worldDavid Voyles
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
How to win a hackathon - Penn APps 2015
How to win a hackathon - Penn APps 2015How to win a hackathon - Penn APps 2015
How to win a hackathon - Penn APps 2015David Voyles
 
Running, improving & maintaining a site in the real world
Running, improving & maintaining a site in the real worldRunning, improving & maintaining a site in the real world
Running, improving & maintaining a site in the real worldDavid Voyles
 
Building web front ends using single page applications
Building web front ends using single page applicationsBuilding web front ends using single page applications
Building web front ends using single page applicationsDavid Voyles
 
Web standards and Visual Studio web tools
Web standards and Visual Studio web toolsWeb standards and Visual Studio web tools
Web standards and Visual Studio web toolsDavid Voyles
 
Build and deploy an ASP.NET applicaton
Build and deploy an ASP.NET applicatonBuild and deploy an ASP.NET applicaton
Build and deploy an ASP.NET applicatonDavid Voyles
 
Cluster puck99 postmortem
Cluster puck99 postmortemCluster puck99 postmortem
Cluster puck99 postmortemDavid Voyles
 
Joe Healy - How to set up your DreamSpark account
Joe Healy - How to set up your DreamSpark accountJoe Healy - How to set up your DreamSpark account
Joe Healy - How to set up your DreamSpark accountDavid Voyles
 
Joe Healy - Students as App Publishers
Joe Healy - Students as App PublishersJoe Healy - Students as App Publishers
Joe Healy - Students as App PublishersDavid Voyles
 
An Introdouction to Venture Capital and Microsoft Ventures
An Introdouction to Venture Capital and Microsoft VenturesAn Introdouction to Venture Capital and Microsoft Ventures
An Introdouction to Venture Capital and Microsoft VenturesDavid Voyles
 
Intro to WebGL and BabylonJS
Intro to WebGL and BabylonJSIntro to WebGL and BabylonJS
Intro to WebGL and BabylonJSDavid Voyles
 

Más de David Voyles (20)

Developing games for consoles as an indie in 2019
Developing games for consoles as an indie in 2019Developing games for consoles as an indie in 2019
Developing games for consoles as an indie in 2019
 
Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019Developing for consoles as an indie in 2019
Developing for consoles as an indie in 2019
 
Overview Microsoft's ML & AI tools
Overview Microsoft's ML & AI toolsOverview Microsoft's ML & AI tools
Overview Microsoft's ML & AI tools
 
Intro to deep learning
Intro to deep learning Intro to deep learning
Intro to deep learning
 
What is a Tech Evangelist?
What is a Tech Evangelist?What is a Tech Evangelist?
What is a Tech Evangelist?
 
Microsoft on open source and security
Microsoft on open source and securityMicrosoft on open source and security
Microsoft on open source and security
 
Students: How to get started in the tech world
Students: How to get started in the tech worldStudents: How to get started in the tech world
Students: How to get started in the tech world
 
Students -- How to get started in the tech world
Students -- How to get started in the tech worldStudents -- How to get started in the tech world
Students -- How to get started in the tech world
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
How to win a hackathon - Penn APps 2015
How to win a hackathon - Penn APps 2015How to win a hackathon - Penn APps 2015
How to win a hackathon - Penn APps 2015
 
ASP.NET 5
ASP.NET 5ASP.NET 5
ASP.NET 5
 
Running, improving & maintaining a site in the real world
Running, improving & maintaining a site in the real worldRunning, improving & maintaining a site in the real world
Running, improving & maintaining a site in the real world
 
Building web front ends using single page applications
Building web front ends using single page applicationsBuilding web front ends using single page applications
Building web front ends using single page applications
 
Web standards and Visual Studio web tools
Web standards and Visual Studio web toolsWeb standards and Visual Studio web tools
Web standards and Visual Studio web tools
 
Build and deploy an ASP.NET applicaton
Build and deploy an ASP.NET applicatonBuild and deploy an ASP.NET applicaton
Build and deploy an ASP.NET applicaton
 
Cluster puck99 postmortem
Cluster puck99 postmortemCluster puck99 postmortem
Cluster puck99 postmortem
 
Joe Healy - How to set up your DreamSpark account
Joe Healy - How to set up your DreamSpark accountJoe Healy - How to set up your DreamSpark account
Joe Healy - How to set up your DreamSpark account
 
Joe Healy - Students as App Publishers
Joe Healy - Students as App PublishersJoe Healy - Students as App Publishers
Joe Healy - Students as App Publishers
 
An Introdouction to Venture Capital and Microsoft Ventures
An Introdouction to Venture Capital and Microsoft VenturesAn Introdouction to Venture Capital and Microsoft Ventures
An Introdouction to Venture Capital and Microsoft Ventures
 
Intro to WebGL and BabylonJS
Intro to WebGL and BabylonJSIntro to WebGL and BabylonJS
Intro to WebGL and BabylonJS
 

Último

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Último (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Using prime[31] to connect your unity game to azure mobile services

  • 1.
  • 2. • Intro to prime[31]’s Azure plugin • Creating a mobile service in the Azure web portal • Installing the plugin • How does Unity handle .DLLs? • Compiling our project • Walking through the code • Azure functions • What other options exist? Source Code: https://github.com/DaveVoyles/prime31-azure
  • 3.
  • 4. prime • Free! • Runs across: Windows 8 Store Windows Phone 8 Does not run in the Unity Editor • Download here: https://prime31.com/plugins#
  • 5. // Prepares the connection to the Azure servers. This must be called before any other methods. public static void connect( string applicationUrl, string applicationKey ) // Inserts a new item into the database public static void insert<T>( T item, Action completionHandler ) // Updates an item in the database public static void update<T>( T item, Action completionHandler ) // Deletes an item from the database public static void delete<T>( T item, Action completionHandler )
  • 6. // Queries the database public static void where<T>( Expression<Func<T,bool>> predicate, Action<List<T>> completionHandler ) // Looks an item up to see if it is in the database public static void lookup<T>( T item, 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. public static void authenticateWithServiceProvider( MobileServiceAuthenticationProvider serviceProvider, Action<MobileServiceUser> completionHandler )
  • 7. prime NOTE: It’s important to note that before you can use this plugin you must download and install the Mobile Services SDK from here.
  • 8.
  • 9.
  • 10. Creating your mobile service https://manage.windowsazure.com/
  • 20.
  • 21. What is a .DLL? A DLL is a dynamic link library. It is a collection of code and/or data, which may be used by several applications (or other libraries/modules). So, common methods to process files, work with GUI components etc. are made available in libraries so several applications may use the same functionality.
  • 22. Handling .DLLs For example: Assets/Plugins/Metro would hold my [prime31] .DLL which connects to Azure.
  • 23. Building .DLLs When Unity builds your project, it first grabs all of the .DLLs within the Assets/Plugins folder. It then does another pass to see if there is a platform-specific folder containing plugins.
  • 24. Is one present? If one is present, it adds those to the build. If there are two plugins with the same name: 1. Unity prioritizes the plugin in the platform-specific folder, and 2. overwrites whatever was in the Assets/Plugins folder.
  • 25.
  • 26. Installing the plugin Download the plugin from the prime[31] site by registering at the site. You’ll receive a download code immediately after, in your e-mail.
  • 27. Installing the plugin Import the whole project into an empty Unity scene
  • 28. Go to File –> Build Settings, located at the top-right corner of Unity. NOTE: Make sure that your Inspector window is visible, because we’re going to change some build settings for Windows 8 here! Add the current scene (MetroAzureTestScene) to the build.
  • 29. Click on Windows Store Apps, and on the right-hand side you will see several options. NOTE: 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.
  • 30. 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.
  • 31. NOTE: You need to add “P31MetroAzure.dll” in this empty field, otherwise Unity never knows to build the project with your Azure plug!
  • 32. You’ll also need to add “Internet Client” to your capabilities section. This allows your Win8 project to connect to the internet. It modifies the AppManifest.XML file which is generated for your WIn8 project.
  • 33. 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”.
  • 34.
  • 35.
  • 36.
  • 37. Something that threw me in a loop initially, was the fact that the project wants to deploy to an ARM device immediately. If you hit debug “Local Machine” it will throw an error about your machine not being an ARM tablet.
  • 38. Go to Configuration Manager and change the Active Solution Platform to X86
  • 39. You can now run your projects and deploy them via Visual Studio. Do that, and you will be greeted with this screen:
  • 40. NOTE: On occasion, I’ll get an error when building the project. I’m not sure of what causes this, but when I switch my deployment from whatever it is currently on (for example, Debug) to Release or Master, it suddenly builds fine. I can then go back to Debug, and use that if I’d like.
  • 41.
  • 42.
  • 43. A container for the things you insert into your leaderboard. It simply holds a name, score, and unique ID for each object you insert into the board. NOTE: username and score MUST be lowercase
  • 44. [SerializeField] private string _azureEndPoint = "<your leaderboard service>"; [SerializeField] private string _applicationKey = "<your application key>";
  • 45. Organizes our buttons and on-screen text.
  • 46.
  • 47. We can update, delete, and insert things into our leaderboard, but before we can update or delete anything, we need to return some leaderboard results. The syntax may look kind of funky, but bear with me:
  • 48. // Grab all scores in our leaderboard which are <= _minScoreToReturn Azure.where<LeaderBoard>(i => i.score <= _minScoreToReturn, itemsInTheLeaderboard => { Debug.Log("queried all scores <= 100 has completed with _leadersList count: " + " " + itemsInTheLeaderboard.Count); _leadersList = itemsInTheLeaderboard; // Loop through each item in the leaderboard list, and draw it to the log foreach (var item in itemsInTheLeaderboard) { GUILayout.Label("Name:" + " " + item.username + " " + "Score" + " " + item.score); } });
  • 49. We use a lambda function as the first parameter, which serves as an anonymous (unnamed) function. i is as each object in our leaderboard list, and we are looking to pull out the scores, so the argument within this lambda function is i.score.
  • 50. Azure.where<LeaderBoard>(i => i.score <= _minScoreToReturn,
  • 51. The next parameter in our Azure.Where() function is itemsInTheLeaderBoard You know those items we just returned from our leaderboard? Well they all get stored in this variable, which serves as list that we can now manipulate. itemsInTheLeaderboard =>
  • 52. I’m not quite sure if I’ve been able to return anything at this point though, so why not draw it to our log, just to be sure? First we take the itemsInTheLeaderboard, and use the count() function (given to us by the fact that this is of type List), and verify that we have some things being returned. Debug.Log("queried all scores <= 100 has completed with _leadersList count: " + " " + itemsInTheLeaderboard.Count);
  • 53. Next, we need to loop through each leaderboard item in this list and draw it to the screen, because what’s the point of having a leaderboard if folks can’t see how they compare to everyone else, right? Using a foreach loop, we iterate through each item in the leaderboard ad draw it to the screen, including the username and score.
  • 54. // Loop through each item in the leaderboard list, and draw it to the log foreach (var item in itemsInTheLeaderboard) { GUILayout.Label("Name:" + " " + item.username + " " + "Score“ + " “ + item.score); }
  • 55. NOTE: You MUST use lowercase values for username and score. You’ll see in our leaderboard class that I even use lowercase values. That’s because the node.js backend we are using on our Azure leaderboard is expecting lowercase values.
  • 56. NOTE: All of the functions in this sample require you to be connected to Azure before you do anything. You must hit the “Connect Azure Service” before anything can take place!
  • 57. if (GUILayout.Button("Insert To Leaderboard")) { Azure.insert(_leaderBoardItem, () => Debug.Log("inserted" + " " + _leaderBoardItem.username + " " + "to leaderboard")); }
  • 58. I’ve entered “Unity Tutorial Test” as the user name and “70″ as the score for the inputs. Hit “Insert To Leaderboard” AFTER you connect, and you’ll be good to go!
  • 59.
  • 60. To update or Delete an item in the leaderboard, we need to perform a few steps: 1. Connect to the Azure Mobile Service 2. Retrieve results from the leaderboard 3. The Update & Delete buttons will now appear on screen, beneath the newly returned results. 4. Grab the latest results from the array in the leaderboard
  • 61. // UPDATE the first (latest) thing in the leaderboard if (GUILayout.Button("Update latest Item")) { // Grab the first item in the leaderboard list var leaderToUpdate = _leadersList[0]; // Set the item's UserName to what we entered in the UserName input field leaderToUpdate.UserName = GUILayout.TextField(_leaderBoardItem.UserName); // Update the item in the leaderboard Azure.update(leaderToUpdate, () => Debug.Log("Updated leaderboard item:" + " " + leaderToUpdate.UserName)); }
  • 62. // REMOVE the first (latest) thing in the leaderboard (then delete it later) if (GUILayout.Button("DELETE LATEST ITEM")) { // Grab the first item in the list var leaderToRemove = _leadersList[0]; // Removes item at the specified index _leadersList.RemoveAt(0); // DELETE it from the leaderboard Azure.delete(leaderToRemove, () => Debug.Log("Deleted latest item from leaderboard:" + " " + leaderToRemove.UserName)); }
  • 63. So after we've returned our results, and the update button appears do the following: 1. Enter a new name (for example, Johnny Quest) 2. Hit the "Update Latest Item" button Now you'll see top item in the leaderboard list says Johnny Quest. Head to your Azure portal just to verify, and you'll see that it works!
  • 64.
  • 65.
  • 67. rave overview • Free! • Requires Newtonsoft.Json • Same project works on Win8 & WP8 • Runs across: UnityEditor Windows 8 Store Windows Phone 8 iOS Android Probably everything else Unity runs on
  • 68. rave • http://www.bitrave.com/azure-mobile-services-for-unity-3d/ • www.DaveVoyles.azurewebsites.net • http://www.parentelement.com/assets/json_net_unity
  • 69. Json.NET Unity Plugin NOTE: You will need the $20 Jon.NET Unity plugin to serialize the JSON data if you are running bitrave on non-Microsoft platforms. Microsoft platforms can use the Newtonsoft.JSON nuget package (download it from within the nuget package manager Visual studio), which is a free .DLL that is referenced from within your Visual Studio project.
  • 70. rave vs. prime[31] • More platforms • Both free
  • 71. • What are Azure Mobile Services? • Creating a mobile service in the web portal OR Visual Studio • Compiling our project – exclude .DLLs! • Other Options – bitrave Source Code: https://github.com/DaveVoyles/prime31-azure