question

tobiassimonbusiness avatar image
tobiassimonbusiness asked

myPlayFabId issue (HTTP 409)

Hello:) During registration, the password and email address will be given. But I would also like to have a DisplayName created, since the UserID is rather useless for the game itself. I would also like to assign the player a nation. In my game, a nation is a faction that the player then belongs to.

I created a SetDisplayName() for the DisplayName and a SetUserData() function for the Nation. Both work, but not together because PlayFab is one Gives HTTP 409 error message. According to the following post, two operations cannot run at the same time:

https://community.playfab.com/questions/38752/http11-409-conflict-on-updateuserdata-and-addorupd.html

I find it strange that the registry doesn't directly allow something like this. Anyway, I have now postponed the second operation until after registration, more precisely it is postponed after loading the next scene, where it is called in a Start() function.

An if() query is used to check whether a nation has already been assigned and if not, this is determined based on the input brought back from the previous scene.

This is the problem at the moment, it is being checked whether in the UserData has already been assigned a “Nation” entry for the logged in player. If so, I would like to get back which entry that is, if not, it should be made up: void GetUserData(string myPlayFabId) // Check if nation is set. { PlayFabClientAPI.GetUserData(new GetUserDataRequest() { PlayFabId = myPlayFabId, Keys = null }, result => { Debug.Log("Got user data:"); if (result.Data == null || !result.Data.ContainsKey("Nation")) SetUserData(); else Debug.Log("Nation: " + result.Data["Nation"].Value); }, (error) => { Debug.Log("Got error retrieving user data:"); Debug.Log(error.GenerateErrorReport()); }); }

The error I have is the following: Assets\Scripts\DivisionManager.cs(23,9): error CS7036: There is no argument given that corresponds to the required formal parameter 'myPlayFabId' of 'DivisionManager.GetUserData(string)'

Can someone help me with that? I got this from here: https://learn.microsoft.com/en-us/gaming/playfab/features/playerdata/quickstart

unity3d
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

·
Neils Shi avatar image
Neils Shi answered

The error message indicates that the GetUserData function is expecting a string argument myPlayFabId, but it’s not being provided when the function is called. To get the player's PlayFabId, you can get it from the LoginResult object after the player has successfully logged in. Or you can choose not to specify the PlayFabId in the API GetUserData request. Because in your case, since you want players to retrieve their player data after registration, and as https://learn.microsoft.com/en-us/rest/api/playfab/client/player-data-management/get-user-data?view=playfab-rest#request-body mentions that if you do not set the request parameter “PlayFabId” (in the request of API GetUserData), it will retrieve the data of the currently logged in player by default.

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.