How to use

Simple Account with Database Asset

  • Version 1.0.1

Get Started



You must imperatively have the playfab SDK in your project. This is a service that will be used to store all player data. Normally this one is attached in the asset, but if you encounter errors delete it and download it here.


Create Your PlayFab Account

Once you have the sdk, you must create a PlayFab account. Go here.


  • Congratulations, you are now connected to the Play Fab services, all you have to do is create your application, to do so, simply follow the steps indicated. You should have this:

    Responsive image

  • Now click on your game to access this information, then follow this video.
    This step is very important, it will allow users to store their data.

    WARNING by checking this box, your game can be submitted to cheat!

    If you want to switch to a secure transfer, this option is available in the Complete Account with Database Asset, which also contains a virtual currency system, friends list, leaderboards, and more....

  • Now, all you have to do is retrieve your game ID, in the settings, from where you were:
    Responsive image
    Copy your Title ID to your clipboard and proceed to the next step.

  • So, now you can go back to Unity to set up your project. In the action bar, go to Database Controller > Settings
    Responsive image
    This window should then open:
    Responsive image

  • Go to the scene you will use for your connection system.

    ATTENTION only one scene can be used per project to avoid any problems.

    Then, in the settings window that was opened earlier, click the “Create this object for me” button. After which, you can enter your application ID (step 3) in the Project ID selection.

    If you are developing a mobile game, and would like to use the anonymous connection option, please switch your project to iOS or Android if you haven’t already done so. This option is only available for mobile.

    Now all you have to do is fill in all the necessary objects in the management window and press “Apply”.
    A confirmation message should appear in the Unity console.

Congratulations, you have successfully configured your project.
Now you can build your level in order to implement the login system for the user.
You can help yourself from the demo scene to better understand.

Implementations (Unity C#)

1 - Get Started

In order to properly prepare your system, you will need only one thing, a script that will manage the elements of your scene.

If you have a problem or hesitation, do not hesitate to consult our demo script, or join us on discord.

Step 1: Open your script, and at the top, insert the following line : ‘using DatabaseAPI.Account;’
Responsive image
(this is our demo script, you can find it in the asset folder > Demo > scripts).
Now, you're able to use our asset in your script.

ATTENTION more namespace can be used, refer to the Extras part of this documentation.

2 - Connection

Step 1: Once the API is imported into your script, you can create your first calling functions.

Here are the available instructions:

  • public void GetUserName(string value) { AccountController.controller.GET_USER_USERNAME(value); }

  • public void GetUserEmail(string value) { AccountController.controller.GET_USER_EMAIL(value); }

  • public void GetUserPassword(string value) { AccountController.controller.GET_USER_PASSWORD(value); }

  • AccountController.controller.LOGIN_ACTION();

  • AccountController.controller.ON_CLIC_CREATE_ACCOUNT();

  • AccountController.controller.LOG_OUT();

Step 2: All right, now, save and go back to unity to link these new functions to your buttons.

The first 3 functions listed above must be added to InputFields, in the “On Value Changed” section.

Responsive image
CAUTION choose the Dynamic string, otherwise your function will not work.

Responsive image
ATTENTION be careful, it's not necessary, but you can select the true option in Content type, Email Address for email, Password for the password, and standard for username.

Now, you just have to put the login or connect function to your button in the on Click function.

3 - Mobile Anonymous Connection

This anonymous login allows the user to start playing without creating an account. The anonymous login still create an account to the user, which will allow him an automatic login every time the application opens. Its ID and password will be defined by its phone ID. Using the anonymous connection does not prevent linking your profile to an existing account or a new one afterwards.

The following step can be found in the demo script, from line 233 to 244.

Step 1: Write the new functions in your script

  • public void OpenCloseRecoverySection() { AccountController.controller.OPEN_RECOVERY_PANEL(); }

  • public void CreateRecoveryAccount() { AccountController.controller.ON_CLIC_ADD_RECOVERY(); }

4 - User Statistics

Well, you’re almost done with this asset. There’s only one thing left to do, save your player’s data.
This section is relatively simplistic, everything is already done for you.

The first thing to know, is that when connecting, all user data is stored in a local dictionary.
You can view it and retrieve this data by simply typing:
AccountController.playerData.TryGetValue(NAME OF THE VALUE SAVED, out VALUE TO UPDATE)
You can see this template in the demo script, line 44.

How to save new data or update one:
AccountController.controller.SetStat(NAME OF THE VALUE TO SAVED, VALUE TO SAVE);
You can see this template in the demo script, line 104.


In this last part of the Asset manual, you can find several small functions that may be useful to you.
  • You can say that this option has no interest, but on the contrary, it’s necessary! When you log in, how do you know if that connection failed, and therefore how do you make sure that you can start the next scene, such as a main menu.

    To access this information, you have this boolean available:
    If you are logged in, this boolean will return True.
    If you are looking for how to integrate it, you can consult the demo script of line 34 to 41.

  • Looking at these lines 34 to 41 of the demo script, you must have seen this:
    This statement is also a boolean. It allows to know the state of loading of the user’s data. This boolean will equal True when all data is finished loading.
    This option allows for example the use of a loading screen, to avoid that once logged in, the user sees erroneous data because not yet updated.

  • It’s also one of the most important elements, how to warn the user of a failure.

    To do this, you have access to a variable that will allow you to directly retrieve the entire error message:
    this simple command allows you to retrieve the error message, then you can either process it or return it as it was to the user.

    Example of use:
    public Text errorMsg; // using UnityEngine.UI;
    void Update() { errorMsg.text = AccountController.DebugMessage; }

  • Do you need your player’s server ID? you can retrieve it by typing AccountController.userID

    User Id is a string that will contain the id of the currently connected player.

    You can find it in the demo script, from lines 59 to 56.

Want more astuces? join us on discord.

How to use PlayFab dashboard

  • Responsive image

  • Once on the players reference page, click on one of the list to access their profile.

    Once on a profile, the Overview page references this personal data, then the Statistics section will show you its data that you have chosen to save online, and finally, the Logins section will show you these latest connections.

    The other sections will probably not be useful to you with this asset, as they are not compatible.

    To go to your dashboard, in the unity action bar go to: Database Controller > Your Dashboard

Want more astuces? join us on discord.