# Create sessions in the Editor

> Create a session in the Unity Editor using ScriptableObjects.

You can create and manage sessions using [ScriptableObjects](https://docs.unity3d.com/Manual/class-ScriptableObject.html) in the Unity Editor. There are two ScriptableObjects related to multiplayer sessions:

* [`MultiplayerSession`](https://docs.unity3d.com/Packages/com.unity.services.multiplayer@latest?subfolder=/api/Unity.Services.Multiplayer.Components.MultiplayerSession.html): Stores sessions and makes lifecycles events available within the Editor.
* [`SessionConnector`](https://docs.unity3d.com/Packages/com.unity.services.multiplayer@latest?subfolder=/api/Unity.Services.Multiplayer.Components.SessionConnector.html): Populates the `MultiplayerSession` ScriptableObject using the existing operations such as Create and Join.

> **Note:**
>
> This functionality is available in the Multiplayer Services package version 2.2.0 and newer.

## Use sessions ScriptableObjects

Follow these steps to use ScriptableObjects in your multiplayer project:

1. [Add a `MultiplayerSession` and `SessionConnector` ScriptableObject](#add-scriptableobjects-to-your-scene).
2. [Connect the `MutliplayerSession` ScriptableObject](#connect-the-scriptableobjects) to the `SessionConnector` ScriptableObject.
3. [Configure](#configure-'sessionconnector'-scriptableobject) the ScriptableObjects to match the needs of your project.
4. (Optional) [Configure `SessionConnectorBehavior` component](#configure-sessionconnectorbehavior)

### Add ScriptableObjects to your scene

To add multiplayer ScriptableObjects to your project, open the **Project** window and right-click in the folder your want to create the assets in. Then navigate to **Create** > **Services** > **Multiplayer**. Select **Multiplayer Session** and then repeat the process and select **Session Connector** along with your preferred connection type to create both.

### Connect the ScriptableObjects

A `SessionConnector` ScriptableObject requires a 'MultiplayerSession' ScriptableObject to work.

Add a `MultiplayerSession` ScriptableObject to a 'SessionConnector' ScriptableObject in the **Multiplayer Session** field of the `SessionConnector` ScriptableObject in the **Inspector** window.

### Configure 'SessionConnector' ScriptableObject

`SessionConnector` supports the following connection types:

* `Create`
* `CreateOrJoin`
* `Join`

From the **Inspector** window, you can also configure the following settings:

* The maximum number of players (default is four).
* The session name.
* If the session is password protected, private, or locked.
* Network options such as IP, port, listen IP.
* Network type: direct, Relay, or none.
* Session operation events.
* Session lifecycle events.

#### CreateOrJoin

The `CreateOrJoin` connection type creates a session when the first user triggers the operation and adds the user to the session. When additional users arrive, they're added to already created session.

This setting is recommended during experimentation and testing because all users are added to the same session.

#### Create

The `Create` connection type creates a new session with a unique ID.

> **Note:**
>
> The `SessionConnector` ScriptableObject retains its settings configuration when exiting Play mode.

#### Join

The `Join` connection type connects players to a specific session by using a [session code](./join-session.md#join-code) or a session ID.

### Configure SessionConnectorBehavior

You can optionally use a `SessionConnectorBehaviour` MonoBehaviour to manage session creation and sign-in in the **Inspector** window instead of in code. Assign a `SessionConnector` ScriptableObject. The MonoBehaviour determines whether to run the `SessionConnector` on sign in or only programatically. The `SessionConnector` determines the connection type (`Create`, `Join`, or `CreateOrJoin`) while `MultiplayerSession` subscribes to all `ISession` events.

The optional setting **Execute On Sign In** controls timing. When enabled, the behavior subscribes to `AuthenticationService.SignedIn` during `OnServicesInitialized()` so the session operation fires automatically the moment the player authenticates. When disabled, you have to call `Execute()` manually, for example from a Join Game button.

### Additional settings

You can enable verbose logging within the **Project Settings** window. Navigate to **Project settings** > **Services** > **Multiplayer** then select the box for **Verbose Logging**.
