question

DetectivePig avatar image
DetectivePig asked

How to create a loading bar for Playfab login

My code is pretty straight forward:


publicvoidLogin(){
stringemail=loginEmail.text; stringpassword=loginPassword.text;
//Playfab login with email and password LoginWithEmailAddressRequestrequest=newLoginWithEmailAddressRequest() { TitleId=PlayFabSettings.TitleId, Email=email, Password=password
};
PlayFabClientAPI.LoginWithEmailAddress(request, Onlogin, OnLoginError); }

I want to ask if it is possible to create a progress bar for this function? I'm not loading other scene, simply hide canvas.

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

Generally, using POST to request JSON data doesn’t support getting the progress of the response. So, we can’t create a progress bar that displays the percentage of the true request progress. A possible workaround is making a fake loading bar or a loop animation on the UI Panel. We can implement the animation using Unity. You can show the loading panel when the login button is clicked. Then you can add the call of hiding panel function in the OnLoginSuccess() and OnPlayFabErro() functions.

10 |1200

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

Talha avatar image
Talha answered

You can make the "Proceed" button appear in the successcallback (Onlogin) of your login function.

or tweak the alpha of the button (Colour) to give the illusion of time passing(loading).

10 |1200

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

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.