Welcome to Friends
The Friends service allows you to boost player engagement by providing players with a social system that works well with other Unity services. With Friends, your players can:
- Send and receive friend requests.
- Build and manage friend lists.
- Block and unblock other players.
- The user sends a message to a friend.
Environments are logical partitions of Unity Game Services that contain data associated with your project. You can set the target environment in the Unity Cloud Dashboard and your initialization scripts.
The Friends service manages relationships of different types. In general, most user relationships don’t change often; however, there are updates users often want to know about as soon as possible. To increase efficiency, the Friends SDK fetches all a user’s relationships one time at startup, then keeps the list up-to-date using push notifications.
The SDK sends change notifications as soon as the changes occur. User relationship changes that trigger a push notification include:
- A friend updates their presence status.
- Updates to the presence state for an individual user.
- The user adds a new relationship. A user creates a
- The user removes a relationship, or a
FRIENDrelationship is otherwise deleted.
The Friends service treats all relationships the same. You can use the various properties of each relationship to decide how to treat that relationship. Each relationship has one or more members (players), each of which might have extra properties that identify that member’s role in the relationship. For example, a
FRIEND_REQUEST relationship always has two members:
- A member with a
SOURCErole (the sender).
- A member with a
TARGETrole (the receiver).
However, the members role changes to
NONE when a
FRIEND_REQUEST relationship changes to a
The SDK provides some wrapper APIs for specific operations to increase the service’s usability.
For example, when you call the
SendFriendRequestAsync method, it calls the
CreateRelationship API and creates a new
FRIEND_REQUEST relationship with the target user.
If there’s already a
FRIEND_REQUEST relationship from the target user, it creates a new
FRIEND relationship. Depending on the state,
SendFriendRequestAsync can result in a
FRIEND_REQUEST or a new