- Gamesparks Vs Playfab
- Playfab Unity Sdk
- Playfab Unity Login
- Unity Download
- Playfab Unity Getting Started
The GameDev Guru posted a useful blog on how to integrate Unity Addressables with PlayFab’s CDN. This is a great way to push updates to your game without players having to download new client builds. Initialize Your Server. I suggest building a local test environment to run your server.

Learn to Create a Leaderboard Display
Hello everyone, I will now teach you how to use PlayFab in Unity 2019 to create a visual display for your leaderboard data. In the last lesson, I showed you how to get all the data and players of a chosen leaderboard in your game. We were not able to create any visual displays for this leaderboard and so that is what we will do in this next video. We will create a new UI panel to be the display of our leaderboard.
Working in Unity
To get started we will open our PlayFab Unity project. Once opened we will first create a new UI panel. We will then add a UI text object to be the title of this panel. We then want to create a container for all the different player listing of our leaderboard. To do this we will create a new UI image and size it to be like a window on our panel. We can also change the color so it stands out. Next, we need to add a mask and ScrollRect component to this GameObject. We will create a second UI image and make it a child to our ScrollRect object. For this image will make it the same width as the parent object by we will make taller so that it hangs down below the ScrollRect. We can then make this object transparent and Finally, we will attach a vertical layout group component to this object.
Create a Player Listing Prefab
Now we need to create the object that will be the listing of each player in the leaderboard. This will be made up of a UI image and two text object as children to the image. You want the image to be almost as wide as the ScrollRect. You will then position the text objects, one at each end. We then need to create a new C# script to attach to this listing object. The script only needs two public Text variables and you can remove the Start and Update functions. Once you have this script create you will need to drag it into the inspector attaching it to our listing Game Object. Then set the two variable to the two text objects of our listing object. Now we can make a new prefab object out of this object. We will create a new folder called Prefabs. We will then drag our listing object into this folder, after which we can delete this listing object from our hierarchy. Lastly, we will create a new UI button for our close button. Make the button into a square and move it to the corner of the leaderboard panel.
C# Programming
Now we need to go to our PlayFabController C# script. We first need to add some new variables. We will need a GameObject variable for our new leaderboard panel. Next we need a GameObject variable for our prefab listing and finally, we need a Transform variable for our container. We will then go to our success callback function for getting the leaderboard data. First set our leaderboard panel variable to active then inside the foreach loop we want to instantiate a new prefab listing for each player and make this object a child to our transform variable. We will then need to get the script attached to each listing object. From here we can then set the text value to our player’s display name and our player’s stat value.
This last thing we need to do in this script is create a public function that we can pair to our close button. Inside this function, we will disable our leaderboard panel. we will the for loop through all the children of the transform variable backward. Inside the for loop, we will destroy each child object.
More Unity
We can now save our script and go back to Unity. Once back in Unity we will need to assign our close panel function to our close button and then we need to set the three new variables of our PlayFabController script. Now we should be able to play our game and test it out. With your game in play mode, you should be able to click the leaderboard button. This should activate your leaderboard panel and populate the panel with all the player listing of the leaderboard data requested. If you then click the close button it should hide the leaderboard panel and destroy all the player listings.
Testing your Unity Project
Thanks for watching this tutorial. If you found it to be helpful, then please give it a like and tell your friends. Join our discord if you have any questions and please subscribe to our channel.
Unlock Code and Member Content

Get started with the PlayFab Party Unity plugin. Follow steps below to install the package and try out example code for a basic task.
Gamesparks Vs Playfab
This quickstart helps you make your first API calls using the Party SDK for Unity. Before continuing, make sure you have completed Getting started for developers and Quickstart: PlayFab Client library for C# in Unity, which ensures you have a PlayFab account and are familiar with logging into PlayFab from your game and the PlayFab Game Manager.
Note
If you intend to use this plugin to develop games based on the Microsoft Game Development Kit (GDK) you need to acquire and install the GDK separately. Please also see details about Unity add-on for Game Core on Xbox consoles.
Requirements
A PlayFab developer account.
An installed copy of the Unity Editor. To install Unity for personal use via Unity Hub, or Unity+ for professional use, see Download Unity. Check on Unity support in documentation of your specific platform if needed. The minimum supported Unity version is Unity 2017 LTS.
A Unity Project – this can be any of the following:
- A brand new project: For more information, see Starting Unity for the first time.
- A guided tutorial project. For more information, see Getting Started with Unity.
- An existing project.
The PlayFab 'core' Unity3D SDK. For information about installing the Unity3D SDK, see the 'Download and install PlayFab SDK' section of Quickstart: PlayFab Client library for C# in Unity.
Download and install the PlayFab Party Unity plugin
Playfab Unity Sdk
Following the steps to download and install the PlayFab Party Unity plugin.
- Download the PlayFab Party Unity Plugin Asset Package (use a distribution point depending on your platform).
- Important! Please see information in README file published with plugin. It is tailored to each particular version and may include important instructions specific to your platform.
- Open your Unity Project.
- Navigate to the location where you saved the .unitypackage and double-click it to open the import dialog.
- To import the PlayFab Party Unity Plugin into your project, select Import.
Set up your scene

This part of the guide shows you how to add the PlayFabMultiplayerManager
to your scene to enable you to call PlayFab Party APIs from Unity.
Before you can create a network, you must have a PlayFab player logged in. For information about logging in a player, see Making your first API call in Quickstart: PlayFab Client library for C# in Unity.
In the Unity editor, in the Project window, navigate to Assets > PlayFabPartySDK > Prefabs.
From the Prefabs folder, drag and drop the PlayFabMultiplayerManager into your scene in the Hierachy window.
Create an empty Game Object in your scene called 'HelloPartyLogic'.
Select the HelloPartyLogic Game Object to open the Inspector.
Select Add Component.
Type 'HelloPartyLogic' and press enter to show the new script menu.
Press enter again to create the new script, HelloPartyLogic.cs.
Find the script in the Project window and double-click it to edit the script.
Add the following using statement to your script:
Add the following code in the Start method to log into PlayFab.
Add the following methods to the class.
The Microsoft GDK and Windows only support x64.
To resolve these issues:
- In the Unity Editor, select File > Build Settings.
- Select your platform. Then from the Architecture dropdown, select either x86_64 or x64.
- Select Player Settings.
- In the right pane, select Other Setting.
- Find the Allow unsafe Code setting and select it.
- Close the Build Settings and Project Settings windows.
Connecting to a network
This part of the guide shows you how to Create and Join a network.
Open the HelloPartyLogic.cs script. In the
OnLoginSuccess
method, add the following code to create and join a network:To define the OnNetworkJoined event handler, add the following code to the class:
Save and click Play in the Unity Editor. The Network ID displays in the Console window.
Joining an existing network
This part of the guide shows you how to join an existing network that another client created.
Open the HelloPartyLogic.cs script. In the OnLoginSuccess method, add the following code to Join a network:
To define an event that fires when your local client joins the network, add the following code to the
OnLoginSuccess
method:To define the OnNetworkJoined event handler, add the following code to the class:.
There are many ways to get the Network ID from the host to other players who want to join. Please refer to the sample in this Unity plugin for an example of how to do that.
Save and select Play in the Unity Editor. The string 'Network joined!' displays in the Console window.
Accessing other players
This part of the guide shows you how to access other players on the network, including the local player.
Playfab Unity Login
To listen for new players joining and leaving the network, register for the OnRemotePlayerJoined and OnRemotePlayerLeft events.
Open the HelloPartyLogic.cs script. In the OnLoginSuccess method, add the following code to Create and Join a network:
Add the following methods to the class:
To access the local player, add the following code to the OnRemotePlayerJoined method:
The PlayFabPlayer class contains properties for identifying the player, muting, and rendering their chat state in a chat UI.
Sending and receiving data messages
This part of the guide shows you how to send and receive data messages. Before you can start sending and receiving data messages, you must join a network.
Open the HelloPartyLogic.cs script. In the OnLoginSuccess method, add the following code to listen for data messages:
Add the
OnDataMessageRecieved
event handler to the class:To send a data message, add the following code to the Update method:
Unity Download
Save HelloPartyLogic.cs and select Play in the Unity Editor.
- In a second client, use the code shown above in Connect to a network to create and join a network.
- Copy the Network ID returned to your first client and connect to the network.
- Click on the scene to send a message. 'Hello (data message)' displays in the Console window.
Sending and receiving chat messages
This part of the guide shows you how to send and receive chat messages and mute remote players. In addition to text chat, Party automatically enables voice chat between players.
Before you can start sending and receiving chat messages, you must join a network.
Open the HelloPartyLogic.cs script. In the OnLoginSuccess method, add the following code to listen for chat messages:
Add the event handler
OnChatMessageReceived
to the class;
Playfab Unity Getting Started
Save HelloPartyLogic.cs and press Play in the Unity Editor.
In a second client, use the code shown above in Connect to a network to create and join a network.
Copy the Network ID returned to your first client and connect to the network.
When you click on your scene, it sends a message and which displays in the Console window.
If you want to give your players the option to mute other players, set the IsMuted property to true.
