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

# PlayFabMultiplayer.CreateAndJoinLobby

> PlayFabMultiplayer.CreateAndJoinLobby

## Method (1 of 2)

Create a new lobby and add the creating PlayFab entity to it.

```csharp theme={null}
public static Lobby CreateAndJoinLobby(PFEntityKey creator, 
    LobbyCreateConfiguration createConfiguration, LobbyJoinConfiguration joinConfiguration)
```

| parameter | description |
| - | - |
| creator | The local PlayFab entity creating the lobby. |
| createConfiguration | The initial configuration data used when creating the lobby. |
| joinConfiguration | The initial configuration data for the member creating and joining the lobby. |

## Return Value (1 of 2)

Output lobby object which can be used to queue operations for immediate execution of this operation.

## Remarks (1 of 2)

This is an asynchronous operation. Upon successful completion, the title will be provided a [`OnLobbyMemberAdded`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyMemberAdded) followed by a [`OnLobbyCreateAndJoinCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted) with the `OnLobbyCreateAndJoinCompleted.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 will be provided a [`OnLobbyCreateAndJoinCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted) with the `OnLobbyCreateAndJoinCompleted.result` field set to a failed error code.

***

## Method (2 of 2)

Create a new lobby and add the creating PlayFab entity to it.

```csharp theme={null}
public static Lobby CreateAndJoinLobby(PlayFabAuthenticationContext creator, 
    LobbyCreateConfiguration createConfiguration, LobbyJoinConfiguration joinConfiguration)
```

| parameter | description |
| - | - |
| creator | The local PlayFab entity creating the lobby. |
| createConfiguration | The initial configuration data used when creating the lobby. |
| joinConfiguration | The initial configuration data for the member creating and joining the lobby. |

## Return Value (2 of 2)

Output lobby object which can be used to queue operations for immediate execution of this operation.

## Remarks (2 of 2)

This is an asynchronous operation. Upon successful completion, the title will be provided a [`OnLobbyMemberAdded`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyMemberAdded) followed by a [`OnLobbyCreateAndJoinCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted) with the `OnLobbyCreateAndJoinCompleted 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 will be provided a [`OnLobbyCreateAndJoinCompleted`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted) with the `OnLobbyCreateAndJoinCompleted result` field set to a failed error code.

## 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)
* class [LobbyCreateConfiguration](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyCreateConfiguration/overview.md)
* class [LobbyJoinConfiguration](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyJoinConfiguration/overview.md)
* class [PlayFabMultiplayer](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/overview.md)
* namespace [PlayFab.Multiplayer](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference.md)


## Related topics

- [PlayFabMultiplayer.OnLobbyCreateAndJoinCompleted](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted.md)
- [PlayFabMultiplayer.JoinLobby](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinLobby.md)
- [PlayFabMultiplayer.JoinArrangedLobby](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinArrangedLobby.md)
- [PlayFabMultiplayer.OnLobbyJoinCompleted](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyJoinCompleted.md)
- [PlayFabMultiplayer.OnLobbyJoinArrangedLobbyCompleted](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyJoinArrangedLobbyCompleted.md)
