> ## Documentation Index
> Fetch the complete documentation index at: https://docs.playtolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Social

> Friends, player search, and friend requests with PlaytoliaSocial

`PlaytoliaSocial` manages the friends list, player search, and friend request workflows. Data loads automatically after login.

### Friends list

```c# theme={null}
var friends = PlaytoliaSocial.GetFriends();
foreach (var friend in friends)
    Debug.Log($"{friend.User.DisplayName} — {friend.User.Status}");
```

### Searching for players

```c# theme={null}
var results = PlaytoliaSocial.SearchPlayers("username");
// returns List<Player>
```

<Note>This is a blocking network call — call it off the main thread or in response to user input, not in Update().</Note>

### Friend requests

```c# theme={null}
// Send
PlaytoliaSocial.SendFriendRequest(player.PlayerId);   // use PlayerId, not Id or Uid

// View pending
var incoming = PlaytoliaSocial.GetIncomingFriendRequests();
var outgoing = PlaytoliaSocial.GetOutgoingFriendRequests();

// Respond
PlaytoliaSocial.AcceptFriendRequest(request.RequestId);
PlaytoliaSocial.RejectFriendRequest(request.RequestId);
PlaytoliaSocial.CancelFriendRequest(request.RequestId);  // cancel outgoing

// Remove
PlaytoliaSocial.RemoveFriend(friend.FriendshipId);   // use FriendshipId, not PlayerId
```

<Warning>`SendFriendRequest` takes a `PlayerId`. `RemoveFriend` takes a `FriendshipId`. Mixing these up is a common mistake.</Warning>

### Listening to changes

```c# theme={null}
void Start()    => PlaytoliaSocial.AddListener(OnSocialChanged);
void OnDestroy() => PlaytoliaSocial.RemoveListener(OnSocialChanged);

void OnSocialChanged()
{
    var friends = PlaytoliaSocial.GetFriends();
    // update UI
}
```

<CardGroup cols={2}>
  <Card title="Party System" icon="users" href="/for-unity/party">Lobbies and matchmaking</Card>
  <Card title="SDK Reference" icon="code" href="/sdk-reference/social">PlaytoliaSocial reference</Card>
</CardGroup>
