> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.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`](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyMemberAdded) followed by a [`OnLobbyCreateAndJoinCompleted`](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted) with the `OnLobbyCreateAndJoinCompleted.result` field set to [`Success`](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyError/Success). Upon a failed completion, the title will be provided a [`OnLobbyCreateAndJoinCompleted`](/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`](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyMemberAdded) followed by a [`OnLobbyCreateAndJoinCompleted`](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnLobbyCreateAndJoinCompleted) with the `OnLobbyCreateAndJoinCompleted result` field set to [`Success`](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyError/Success). Upon a failed completion, the title will be provided a [`OnLobbyCreateAndJoinCompleted`](/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](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/overview)
* class [PFEntityKey](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PFEntityKey/overview)
* class [LobbyCreateConfiguration](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyCreateConfiguration/overview)
* class [LobbyJoinConfiguration](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/LobbyJoinConfiguration/overview)
* class [PlayFabMultiplayer](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/overview)
* namespace [PlayFab.Multiplayer](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference)


## Related topics

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