Commonly caused by using incorrect usernames: missing #0000 numbers, case differences, whitespace, or confusing characters.
Retrieve names with GetPlayerNameAsync() and enable copying to the clipboard, as demonstrated in the Friends Sample.
When using the Friends Service and trying to add a friend, here are some common causes for an internal server error: user not found error
- Friend user name must contain the #0000 number (eg. "username#0000")
- Usernames are case-sensitive
- Trailing or starting whitespaces should be removed
- Some fonts can make it difficult to differentiate between certain characters
Recommended Approach
We recommend getting a username directly from the Authentication service through GetPlayerNameAsync() and implementing a copy to clipboard feature to share with friends more easily.
You can see an example of this in the Friends Sample, which uses the following:
var playerName = await AuthenticationService.Instance.GetPlayerNameAsync();var relationship = await FriendsService.Instance.AddFriendByNameAsync(playerName);GUIUtility.systemCopyBuffer = m_NameText.text;