Start Creating Cloud Saving Games
- Azure Playfab
- Playfab For Unity
- Playfab Unity Multiplayer
- Something Went Wrong Installing Unity
- Playfab Unity Getting Started
- Playfab Unity
For this new tutorial series, we will be teaching you about the Playfab SDK and how to use it in Unity 3D. Using onenote on ipad. The PlayFab plugin helps the developer implement cloud saving features and other bonus features in their projects. Cloud saving is very important to have, especially if your game is multiplayer or has In-App Purchases (IAPs).
- HowTo: Use Google SignIn (GPG) + PlayFab (Unity) This tutorial illustrates the steps to successfully add Google Play Games sign-in to your PlayFab games, built with the Unity SDK. Actually, this should be a fairly simple procedure, once you know all the steps. However, finding.
- Hi, I'm getting a bunch of warnings in Unity with PlayFab asset on the same style as this (350 + warnings): AssetsPlayFabSDKSharedIonic.ZlibInflate.cs(120,32): warning CS0436: The type 'ZlibCodec' in 'E:PortalUnityARpresenterAssetsPlayFabSDKSharedIonic.ZlibZlibCodec.cs' conflicts with the imported type 'ZlibCodec' in 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken.
Playfab: https://playfab.com/features/
SUBSCRIBE for regular Video Game making videos:
https://www.youtube.com/channel/UCyoayn_uVt2I55ZCUuBVRcQ?sub_confirmation=1
Our Unity3d PlayFab SDK provides everything you need to access the PlayFab API. This includes models, methods, an HTTP wrapper for sending and receiving web requests, and JSON serialization. This SDK is auto-generated using our open-sourced tool— SDKGenerator. We generally build SDKs every other week to stay current with the latest API changes.
Learning about PlayFab
Welcome to Info gamer for this lesson we will show you how to get started with the PlayFab SDK in Unity. We have been receiving a number of requests from many of our subscribers to do this series so here we go.
If you want to learn about all the different feature PlayFab offers your game you can then go to the PlayFab link I have provided above. Cloud saving is going to be the most important feature you can implement in your game.
New Project
To get started we will want to create a new Unity project. We then want to navigate over to the PlayFab documentation. We can then scroll down to where it says pick your SDK. We will select the Unity link. This will take you to where you can download the Unity PlayFab SDK extension package.
Import the Package
Once you have this Package downloaded to your computer we then need to go to our newly created Unity Project. We will then go to Assets > Import Package > Custom Package. You will then need to find to the location where you save the PlayFab package, select it, then click import. This will then open a new window with a list of everything in the package. With everything selected we will click import and then we must wait for our project to finish processing the new files.
Connect to PlayFab
Once import you will see another new window called PlayFab EdEx. In this window, you can register yourself and the studio with the PlayFab website. If you already have an account you can skip this step. Once you and your project are registered you then need to connect your project title to your registered account. You can do this using the drop-down menu provided. After this, your project is all set up and connected to your PlayFab account.
Watch How to Import PlayFab SDK
Azure Playfab
-->Tutorial video
Note
The audio portion of the following video is currently unavailable. A new recording is pending, and will be available in the immediate future.
This tutorial illustrates the steps to successfully add Google Play Games sign-in to your PlayFab games, built with the Unity SDK. Actually, this should be a fairly simple procedure, once you know all the steps.
However, finding all the required information can be tricky. So we will try to centralize all the steps you need to get this feature working.
You can also download the sample for this tutorial here.
Prerequisites
- A project built using the Unity game engine.
- A Google developer account.
- A PlayFab developer account that has access to a game title in PlayFab.
- The PlayFab Unity Editor Extensions & Unity SDK.
- The Google Play Games SDK.
- Familiarity with Login basics and Best Practices.
Getting started
First, we will start by setting up some basic things in Google Play. There are a few good guides on how to do this, so we are not going to reinvent the wheel.
- Create an Application - If you have not done so already, you will need to create an application in the Google Play Developer Console.
- Build your game APK, and upload it as an Alpha Build.
- Select Manage Releases.
- Select Manage Alpha.
- Select Upload APK.
- Setting Up Google Play Games Services - Watch the YouTube video, as the link here is dated, and does not reflect the latest UI of Google Play Games services.
- Download the Google Play Games SDK (if you have not done so already) and install it.
- Install the PlayFab Unity SDK (if you do not know how to do this, follow the Unity3D quickstart guide).
Configuring Google Play Games
You can configure Google Play Games from the toolset that is installed with the Google Play Games SDK. You can get to these tools by:
- Going to the Window tab.
- Selecting Google Play Games.
- Going to Setup.
- Then accessing Android Setup.
- Copy your Application ID from the Linked apps section of Game Services in the Google Play Developer Console, as shown in the example provided below.
- Then, populate your
app_id
andpackage_name
in the resource definition, as shown below.
Note
The Client ID that is generated for you when you link the App (shown in this image) is NOT the correct one!
In order to get the Google Sign-In working with PlayFab, you need to use a Web Client ID. To obtain your Web Client ID, you must link a Web Application in the Game Services section of the Google Play Console under the Services and API section.
Then configure your app for the web.
From here, you enter your API Endpoint which can be found in PlayFab:
Playfab For Unity
- Look under Settings.
- Select the API tab.
- Go to the API endpoint field.
- Enter this endpoint https://[titleid].playfabapi.com in the Launch URL field.
- Select the Save button.
- This will provide you with the proper Client ID.
To obtain your secret key, follow the link to your API Console.
Playfab Unity Multiplayer
- Select your Web Application (Type).
- The Client Secret is at the top.
Important
You must change the default callback for Authorized redirect URIs. The proper URI is https://oauth.playfab.com/oauth2/google
.If you do not do this step you will get a mismatch redirect_uri error.
PlayFab Google Sign-In setup
PlayFab has its own process for setting up a Google sign-in. You can do this in your PlayFab developer account. If you don't have one, you can sign-up here.
To set up Google in PlayFab:
Something Went Wrong Installing Unity
- Navigate to the Add-ons section in your dashboard.
- Go to the Google Add-On.
- From there, select the Install Add-on button.
Playfab Unity Getting Started
There are a few things you need to enter into this form:
- The Google App Package ID - This is the name of your Android package. For example, our sample uses
com.playfab.gpgexample
. - The Google App License Key - While this is a required field, it is not related to the Google Sign-In. This field is for setting up a Receipt Validation using our Receipt Validation APIs.
Note
You can get this License Key from the Google Developer Console under the Services & APIs section. Look for a section entitled YOUR LICENSE KEY FOR THIS APPLICATION. Copy and paste the Base64-encoded RSA Public Key into this field.
- The Google OAuth Client ID - This is the Web Client ID that you used in the Google Play Games SDK setup in Unity.
- The Google OAuth Client Secret - This is the secret key that you obtained in the last step.
Adding Google sign-in to your Unity Game
The code to get Google sign-in working is fairly minimal. There is the initialization code, which you will put in your Start (or anywhere you are initializing or starting up your app).
This can be in different places, depending on the architecture and framework of your game or app. In any case, the code below will initialize Google Play Games.
Note
Make sure that you don't forget the using statements, so that you can use the Google Play Games SDK.
The next set of code, the OnSignInButtonClicked()
function shown in the example provided below, is bound to a Sign In button in the UI in our example.
The OnSignInButtonClicked()
code can be a bit overwhelming, so let's break down exactly what is happening:
- First, we log in with
Social.localUser.Authenticate
- This will return a boolean if we are able to successfully login. Be aware that if you have not added your test account to your app, this will always return False when testing. - When this happens - important step here - add your test account.
- The link will take you to instructions on adding testers to your Google application.
Playfab Unity
Note
This is what will trigger the Google Play Games sign-in dialog to pop-up.
- Next, if we have a successful login, we make a call to
PlayGamesPlatform.Instance.GetServerAuthCode
, and store it in a variable. - Lastly, we make the
LoginWithGoogleAccount
call, and pass theAuthCode
we just got from Google in as theServerAuthCode
parameter.
There is a callback which will have the results of your login to PlayFab. At this point, you should see a successful login in your dashboard!
Super resize. Hopefully, this guide has helped you. But if you have questions, feel free to ask them in our community forums.
You can download the sample for this tutorial here.