question

wendsaaaa avatar image
wendsaaaa asked

Hello ireally need help for my capstone project. How can i log out in playfab? because i need to exit my game just to update the changes in my database. whats wrong with my logout function.

public void logout() { PlayerPrefs.SetString("Player", null); PlayerPrefs.SetString("Player1", null); if (PhotonNetwork.isNonMasterClientInRoom || PhotonNetwork.isMasterClient) { PhotonNetwork.Disconnect(); PhotonNetwork.DestroyPlayerObjects(PhotonNetwork.player.ID); PhotonNetwork.LoadLevel(GameConstants.LOGIN_SCENE); } }

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

·
JayZuo avatar image
JayZuo answered

In your code, I didn't see any PlayFab related code. If you have any problem with Photon Network, I'd suggest you ask in Photon forums: http://forum.photonengine.com. And for PlayFab, there is no log out function as PlayFab uses RESTful API to interact with the PlayFab services and RESTful API is stateless. You can just exit your game, the session ticket will expire automatically. There is no need to worry about this.

6 comments
10 |1200

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

wendsaaaa avatar image wendsaaaa commented ·

Im sorry. But i am asking how can i logout in playfab? Why playfab details are not geting destroyed after i relogin to.my game

I need to exit my game and open it again to si changes. For example. Uadmin i login the ill click my logout button it will go back to login scene then ill login user the ill see all information of the admin. If i exit the game and open it again when i login user everything is fine? Pls help me this is for my capstone project.
0 Likes 0 ·
brendan avatar image brendan wendsaaaa commented ·

Put another way: There is no "logout" in PlayFab. All of our SDKs support clearing the Session Ticket locally (look at ForgetAllCredentials in the Unity SDK, for example). PlayFab is a Web API based service (though we'll be adding a socket connection option later this quarter). So each call from a client is processed when it comes in, based upon the state of the data being used at that time.

It sounds like what you're actually asking is how to delete user accounts, so that you can re-test on the same device and have a new player account - is that the case? If so, there's a delete option on the player account in the PlayFab Game Manager, though we recommend unlinking all the account authentication systems from the account first, so that you can re-use them immediately (deletion can take a while).

0 Likes 0 ·
wendsaaaa avatar image wendsaaaa commented ·

No sir its not about deleting account. I wonder why every time i make change in playfab datase i need to exit and open my game again just for me to see the changes. I think i need something that will forgot all the credentials to see the changes. Because i wonder what is the diference between exiting my game and making a button to go back to log in scene where everything started.

0 Likes 0 ·
brendan avatar image brendan wendsaaaa commented ·

Login has nothing to do with getting updated on the data. The issue is that you only have locally on the client the last data you queried from the service. To update that data, you need to query it again - GetUserData, GetPlayerStatistics, GetPlayerCombinedInfo, etc.

It sounds like your client's logic currently is that on login, using InfoRequestParameters, or just after, you're getting information about the player. If you want to get the latest version of that data later, you don't need to sign in again, you just need to query for that data.

0 Likes 0 ·
wendsaaaa avatar image wendsaaaa commented ·

And is there any way for my player too add amout in my virtual currency ?

0 Likes 0 ·
brendan avatar image brendan wendsaaaa commented ·

You can sell VC to players using the economy system (put it in a Bundle item that expires after a few seconds, and it'll drop off the VC then clean itself up), or grant it to them via the Server API either through Cloud Script or your own custom game server code. You can also turn on the Client API call that allows the client to add and subtract VC, but we strongly discourage that, as it allows a hacked client to add any amount of VC to the player account.

0 Likes 0 ·

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.