activedreaminc avatar image
activedreaminc asked

Place Loading screen until PlayFab Player Account Info Fully Loaded

Hi everyone,

From my Login Scene to my Main Menu Scene where I display player Level, XP, Player virtual currencies, etc; it takes about 4-5 seconds until it's fully loaded with appropriate values in the Text UI. I wonder how to place a loading screen that perhaps could show the progress until all values are populated correctly in the Text UI then display the Main Menu Scene?

Thank you for your help and support

Player DataAccount ManagementAuthentication
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Seth Du avatar image
Seth Du answered

Hi, we notice your development environment is Unity and C#, and here is some thoughts about this issue.

If the loading process is synchronous, the first idea is manually counting the number of OnSuccess callbacks when you login the game(it might look ugly). This number can be used for a loading bar(for demonstrating progress) in the loading screen, and the progress increases with the callback number increases.

If the tasks for loading players’ data are asynchronous (which will save time on loading), WaitUntil function in Unity works perfectly in the coroutine. You can make a fake increasing progress at the beginning and it does increase every time one of the tasks finishes. After all tasks are done, the progress bar completes the rest of the progress.Besides, setting a minimum delay time is necessary before the game starts.

As a kind remind, this forum is mainly for Playfab discussion, please check out Unity official forum if possible. Thanks.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

activedreaminc avatar image activedreaminc commented ·

Hi @SethDu,

thank you for your help. I was not sure if I should put this in Unity forum or PlayFab forum since I am currently getting the level, exp, win, lose data using GetPlayerStatistics function from PlayFab. When I put all those function calls in awake instead of start, the delay shorten from originally 4-5 seconds to 1-2 seconds. But it is still noticeable, after successfully pass through the Login Scene, the player will just see a white screen that slowly gets populated with Player Name, Level, EXP, Win, Lose, and virtual currencies (all grab from PlayFab).

So, if I want to implement WaitUntil method, what PlayFab callback parameters should I pass in?

Thank you for your reply and support

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ activedreaminc commented ·

In your case, since the loading time is unavoidable, we suggest you adding a dedicated loading screen for data retrival. When you press the login button, the loading screen will show and in the background, users try to login, then get Name, Level, Exp and etc. After all data is loaded and saved, users enter INFO display panel you mentioned or next scene. You can set up your new scene whatever you want. Details about loading progress bar are provided in the previous comments.

In terms of WaitUntil, I mentioned it because you can set up a parameter that will receieve numbers as a counter from API onSuccess call or flags to detect if data retrival has accomplished . This is not a part of PlayFab that natively provides and you have to design on your own.

//An example for demonstration: 

private bool loadingEndFlag =false;

Void Start() {

IEnumerator EnterNewScene() {
     //wait for all data is loaded
yeild return new WaitUntil( ()=> loadingEndFlag <= true);
//enter the new scene here
1 Like 1 ·
brendan avatar image brendan Seth Du ♦ commented ·

One other suggestion: It sounds like you're collecting all that info using multiple API calls. Given that the time for PlayFab to respond to the request is minimal (you can see the average time to process each call in your API Usage Details report), that means most of the time is spent waiting on the latency of transmission. Have you considered using GetPlayerCombinedInfo, so that you can minimize the number of calls needed?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.