After authenticating with LoginWithDeviceId
I attempt to update the user account display name with something usable with the following code:
private User _user; //Acquired from ApiClient
#if UNITY_EDITOR || DEVELOPMENT_BUILD
private const string DEV_EMAIL = "example@example.com";
#endif
private void UpdateUsername()
{
string username = $"Player{UnityEngine.Random.Range(0, 9999)}";
void UpdateUsernameCallback(Result<UserData> result)
{
if (!result.IsError)
{
PlayerName = result.Value.displayName;
}
else
{
LogError("UpdateUsername", result.Error);
}
_updatingDisplayName = false;
}
_user.UpdateUser(new UpdateUserRequest()
{
emailAddress = DEV_EMAIL,
displayName = username
}, UpdateUsernameCallback);
}
I get a successful response which even includes the new username but when viewing accounts in the dashboard it doesn’t appear to have taken effect.
Additionally, I found it confusing that I had to include an e-mail address in order to update a username - the API doesn’t allow updates without one it seems.
Using AccelByte Unity SDK 16.24.0