# Quickstart: Unity

> Connect a Unity project to SyncVerse Cloud and get two players into one room.

Source: https://syncverse.aqaddoura.com/docs/quickstart

## Before you start

- Unity 2021.3 LTS or newer.
- A SyncVerse Cloud account and a project. [Sign in](https://syncverse.aqaddoura.com/login), create a project, and copy its App ID (it starts with `sv_app_`).

## Install the package

In Unity open **Window › Package Manager**, choose **Add package from git URL** and paste the package URL.

**Package URL**

```text
https://github.com/simple-yet-efficient/syncverse-unity.git#v0.2.0
```

The `#v0.2.0` suffix pins the release; drop it to follow the latest code. Newtonsoft JSON is installed with the package. Example scenes are in [syncverse-samples](https://github.com/simple-yet-efficient/syncverse-samples).

## Add your App ID

1. Open **SyncVerse › Cloud Setup**. It creates the settings asset if there is none.
2. Paste the App ID and set **Mode** to **Cloud**. Check that **Cloud URL** is `wss://syncverse.aqaddoura.com`.
3. Press **Test connection**. It reports the server's welcome, or the reason a connection was refused.

You can also create the asset with **Assets › Create › SyncVerse › Settings**. It must be named `SyncVerseSettings` and live in a `Resources` folder, because the SDK loads it from there.

## Make a networked prefab

1. Create a prefab named `Player` under `Assets/Resources/`.
2. Add **SyncVerseView** and **SyncTransform** to it.
3. In your movement script, only read input when `GetComponent<SyncVerseView>().IsMine` is true.

## Connect, join and spawn

Add this component to an object in your scene and press Play.

**QuickStart.cs**

```csharp
using SyncVerse;
using UnityEngine;

public class QuickStart : MonoBehaviour {
    readonly SyncVerseMaster master = new SyncVerseMaster ();
    SyncVerseRoom room;

    void Start () {
        master.OnConnectFailed += reason => Debug.LogError ("SyncVerse: " + reason);
        master.OnConnected += () =>
            // Creates "my-room", or returns the existing one so you join it.
            master.CreateRoom ("my-room", new RoomOptions { MaxPlayers = 8 }, res => {
                if (res.Room == null) { Debug.LogError ("Create failed: " + res.Status); return; }
                room = master.ConnectToRoom (res.Room);
                room.OnConnected += () => room.Join ("Player" + Random.Range (1, 1000));
                room.OnJoined += () => room.Instantiate ("Player", Vector3.zero, Quaternion.identity);
            });
        master.Connect (); // no URL: uses the SyncVerseSettings asset
    }
}
```

Build the game, or open a second editor with the same project, and press Play again. Both players end up in `my-room` and see each other move. The dashboard's **Rooms** page shows the room and both players.

## Next steps

- [Rooms and the lobby](https://syncverse.aqaddoura.com/docs/rooms): room lists, properties, the master client.
- [Networked objects](https://syncverse.aqaddoura.com/docs/networked-objects): ownership and syncing your own components.
- [RPCs](https://syncverse.aqaddoura.com/docs/rpcs): calling methods on every client.
