> ## 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.

# Party System

> Multiplayer lobbies and matchmaking with PlaytoliaParty

`PlaytoliaParty` manages pre-game lobbies — create parties, invite players, set ready status, and queue for matchmaking.

### Creating and joining

```c# theme={null}
PlaytoliaParty.CreateParty();                        // default: max 4, with join code
PlaytoliaParty.CreateParty(maxSize: 6, generateJoinCode: true);

PlaytoliaParty.JoinByCode("ABC123");
PlaytoliaParty.AcceptInvite(inviteId);
```

### Party status

```c# theme={null}
PlaytoliaParty.IsInParty()      // bool
PlaytoliaParty.IsLeader()       // bool
PlaytoliaParty.IsMatchmaking()  // bool

var party   = PlaytoliaParty.GetCurrentParty();  // Party? (null if not in party)
var members = PlaytoliaParty.GetMembers();       // List<PartyMember>
```

### Member actions

```c# theme={null}
PlaytoliaParty.SetReady(true);
PlaytoliaParty.InvitePlayer(playerId);
PlaytoliaParty.LeaveParty();
```

<Note>If the leader leaves, leadership transfers automatically to another member. The last member leaving disbands the party.</Note>

### Leader-only actions

```c# theme={null}
PlaytoliaParty.KickMember(memberId);
PlaytoliaParty.TransferLeadership(memberId);
PlaytoliaParty.StartMatchmaking("ranked");    // queue name from dashboard
PlaytoliaParty.CancelMatchmaking();
```

<Warning>All leader-only methods silently do nothing if called by a non-leader. Check `IsLeader()` before showing these controls in your UI.</Warning>

### Listening to changes

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

void OnPartyChanged()
{
    createJoinScreen.SetActive(!PlaytoliaParty.IsInParty());
    lobbyScreen.SetActive(PlaytoliaParty.IsInParty());
}
```

<CardGroup cols={2}>
  <Card title="Social" icon="user-group" href="/for-unity/social">Invite friends from your friends list</Card>
  <Card title="SDK Reference" icon="code" href="/sdk-reference/party">PlaytoliaParty reference</Card>
</CardGroup>
