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

# Lobby.AddMember

> Lobby.AddMember

## Method (1 of 2)

Add a local user as a member to the lobby.

```csharp theme={null}
public void AddMember(PFEntityKey localUser, IDictionary<string, string> memberProperties)
```

| parameter | description |
| - | - |
| localUser | The PlayFab Entity Key of the local user to add to the lobby as a member. |
| memberProperties | The initial member properties to set for this user when they join the lobby. |

## Remarks (1 of 2)

This is an asynchronous operation. Upon successful completion, the title is provided a [`OnLobbyMemberAdded`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyMemberAdded) event followed by a [`OnAddMemberCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnAddMemberCompleted) event with the `OnAddMemberCompleted result` field set to [`Success`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyError/Success). Upon a failed completion, the title is provided a [`OnAddMemberCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnAddMemberCompleted) with the `OnAddMemberCompleted result` field set to a failed error code.

This method is used to add an extra local PlayFab entity to a pre-existing lobby object. Because the lobby object must have already been created either via a call to [`CreateAndJoinLobby`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/CreateAndJoinLobby) or [`JoinLobby`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinLobby), this method is primarily useful for multiple local user scenarios.

This is an asynchronous operation. The member added via this method will not be reflected in the lists returned by [`GetMembers`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/GetMembers) until the asynchronous operation successfully completes.

***

## Method (2 of 2)

Add a local user as a member to the lobby.

```csharp theme={null}
public void AddMember(PlayFabAuthenticationContext localUser, 
    IDictionary<string, string> memberProperties)
```

| parameter | description |
| - | - |
| localUser | The PlayFab Entity Key of the local user to add to the lobby as a member. |
| memberProperties | The initial member properties to set for this user when they join the lobby. |

## Remarks (2 of 2)

This is an asynchronous operation. Upon successful completion, the title is provided a [`OnLobbyMemberAdded`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyMemberAdded) event followed by a [`OnAddMemberCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnAddMemberCompleted) event with the `OnAddMemberCompleted result` field set to [`Success`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyError/Success). Upon a failed completion, the title is provided a [`OnAddMemberCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnAddMemberCompleted) with the `OnAddMemberCompleted result` field set to a failed error code.

This method is used to add an extra local PlayFab entity to a pre-existing lobby object. Because the lobby object must have already been created either via a call to [`CreateAndJoinLobby`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/CreateAndJoinLobby) or [`JoinLobby`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinLobby), this method is primarily useful for multiple local user scenarios.

This is an asynchronous operation. The member added via this method will not be reflected in the lists returned by [`GetMembers`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/GetMembers) until the asynchronous operation successfully completes.

## See Also

* class [Lobby](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/overview.md)
* class [PFEntityKey](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PFEntityKey/overview.md)
* namespace [PlayFab.Multiplayer](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference.md)


## Related topics

- [Real-time messages for Lobby and Matchmaking APIs](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/overview.md)
- [PFLobbyAddMemberCompletedStateChange](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyaddmembercompletedstatechange.md)
- [PFLobbyAddMember](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbyaddmember.md)
- [Add Members](https://docs.xbox.com/services/playfab/api-references/rest/groups/groups/add-members.md)
- [Lobby.GetMemberProperties](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/GetMemberProperties.md)
