question

Jeff Orkin avatar image
Jeff Orkin asked

Can I set UserData when I register a new user?

I am using Unity/C#. When I call RegisterPlayFabUser(), I would also like to set some custom UserData for things like FirstName, LastName, ReferralSource. I see that RegisterPlayFabUser() has an optional last parameter customData that is of type object. I am unsure what to pass into that parameter, or whether it is for what I want to do.

My current work around is to call UpdateUserData() after I get the success callback from registration, and pass in a Dictionary<string,string>. That works, but I would prefer to do it all in only one call. Can I pass that same Dictionary as the customData in the call to RegisterPlayFabUser?

10 |1200

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

brendan avatar image
brendan answered

I see the confusion - I'll file a bug with our doc team to get the CustomData documented more clearly. What you use CustomData for is to pass in data which you will then get back when you process the response. This is specifically for developers using languages that don't support conveniences like closures (as well as those not familiar with them), so that they can know which call was responsible for the response they're processing.

If you want to set some user data on a player right after account creation, you should use the UpdateUserData (UpdateReadOnlyUserData, etc.) call to do so, just as you describe.

10 |1200

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

Jeff Orkin avatar image
Jeff Orkin answered

Ok, that makes sense. 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.

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.