Published on

Set up a cloud backend for your game (Pretty useful for free!) (PlayFab / Unity)

  • Evelyn
    Full-time IndieDev.
    I'm Japanese, so please forgive me if my English is strange.

Please share this article if you like!

I'd like to easily implement ranking and push notification functions in my games.

If you're reading this article now, I'm sure you have such thoughts. In this article, I'd like to show you how to set up PlayFab first, in order to implement the functions that require such a server.

I recommend you use PlayFab. I implemented a ranking function in a game I developed, and it was very easy and free to implement.

PlayFab is a cloud backend service operated by Microsoft, and is characterized by its very wide range of free applications.

Why do I recommend PlayFab?
  • You can implement functions that require a backend without having to prepare your own server.
  • Free up to 100,000 MAU
  • It has been used in Minecraft and many other applications.

There is also a video explaining the process, if you want to watch it.

Table of Contents

Importing the SDK

Let's go ahead and import the PlayFab SDK into any Unity project. Please visit the download link from the following URL. Then download the two SDKs circled by the red line.

PlayFab SDK for Unity
PlayFab SDK for Unity

Once the download is complete, drag and drop the package into the Unity editor to complete importing the package.

Setting Up Your Project

Once the SDK has been imported, we'll prepare it for use in our Unity project by opening the PlayFav editor extension.

If you already have a PlayFab account, please login. If you don't, we'll proceed as if you were creating an account.

Click on the icon to the right of the Editor Extension logo display to go to the PlayFab website, and enter the e-mail address and password you just created to log in. The first time you log in, you will be asked to verify your e-mail address, so make sure you do.

Create a new PlayFab title. It is best to use the same name as your game for clarity.

Go back to the Unity editor and select STUDIO and the title you just created.

Test the connection to the server.

Now that the setup is complete, let's create a test code for verification. We will create a script and edit it in Visual Studio.

We will implement a simple login to make sure the tuna is properly teched to the server. The code looks like the following.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PlayFab;
using PlayFab.ClientModels;

public class TestPlayFab : MonoBehaviour
  void Start()
      new LoginWithCustomIDRequest { CustomId = "testuser", CreateAccount = true },
      result => Debug.Log("login success!!"),
      error => Debug.Log($"login failed: {error}")

Attach the script you have created to a game object and run it.

A successful login text will appear in the console, confirming that the player has been added to the PlayFab management screen.

![Execution result]](/static/images/blog/playfab-setup/playfab-setup-10.jpeg)

What did you think of this article? Did you successfully complete the setup? I hope you'll read the Evelyn GameDev Blog, where I'll be showing you how to use PlayFab to implement the ranking function and push notifications.

Summary of this article

Let's set up PlayFab and get ready to implement various functions.

Please share this article if you like!