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:
Retrieve player name (Link)
var playerName = await AuthenticationService.Instance.GetPlayerNameAsync();Add Friend (Link)
var relationship = await FriendsService.Instance.AddFriendByNameAsync(playerName);Copy player name to buffer (Link)
GUIUtility.systemCopyBuffer = m_NameText.text