How to install PlayFab into Unity

This quickstart helps you deploy PlayFab SDK before doing any API call in the Unity engine. Before continuing, make sure you have completed Getting started for developers, which ensures you have a PlayFab account and are familiar with the PlayFab Game Manager.

Download PlayFab SDK

Download the PlayFab SDK for Unity on your computer. Sources are available on GitHub

You can also use the Editor Extension package, but as this component only rely on the PlayFab Account Authentication and we want to manage this mechanism with our Corporate Azure AD Account, we will proceed manually.

Install & Setup PlayFab SDK in Unity

  1. Open Unity Hub and Select Create a new project.
  2. Select 2D Template and define your Project Name and location.

At this point, you have a blank project with only 1 scene store in your Asset Folder.

Deploy PlayFab SDK

From the Unity editor, go to Assets > Import Package > Custom Package and then select the downloaded PlayFabSDK package.

Import a custom Package into Unity
Import PlayFab SDK Package into Unity

If you already have an old SDK Version imported, you should delete the folder before to avoid any issue later on

Configure PlayFab SDK

You have to define the Game Title that will host Player Authentication for your game. You will find your Title ID on your Studio page

This can be done on 2 ways :

  • Add PlayFabSettings.TitleId = "YourTitleID"; somewhere in your code – or
  • In your Unity Project tab, navigate to: assets/PlayFabSDK/Shared/Public/Resources and select the PlayFabSharedSettings and fill the Title Id field.
Define your PlayFab Title Id in Unity Inspector
Define your PlayFab Title Id in Unity Inspector

Test your PlayFab SDK

To check the this import have been done well, you can follow

Share your love
Default image
Laurent LEFEVRE
I’m a Microsoft employee, working on Technology Strategy for a large Enterprise account. You can easily assume / understand that I will not covert non-Microsoft Technologies. I will focus on how you can leverage Azure Game Stack for your Game. Even if I’ve some knowledge on infrastructure and development – due to my 20 years spent in consulting, I will assume that I don’t know anything. So, for each post, I’ll provide guidance and/or links related to training. This is sometimes a great habit to do a full knowledge refresh. Specially when facing the cloud technologies. If you are a senior Developer, please be soft. You may already know everything I am describing there.
Articles: 8

Leave a Reply