> For the complete documentation index, see [llms.txt](https://wiki.playgama.com/playgama/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.playgama.com/playgama/bridge-sdk/setup.md).

# Setup

{% hint style="info" %}
You are reading the documentation for Bridge SDK **v2**. If you need the obsolete v1 documentation, see [Documentation (v1)](https://wiki.playgama.com/playgama/bridge-sdk-v1).
{% endhint %}

## Installation

Install the Bridge package for your engine:

{% tabs %}
{% tab title="Plain JS" %}
JS Core contains the shared SDK logic. Engine packages for Unity, Godot, Construct and other engines are wrappers around JS Core. Use JS Core directly in web engines such as PlayCanvas, Phaser, LayaAir and similar frameworks.

#### Integration

Add the script from CDN:

```html
<html>
    <head>
        <script src="https://bridge.playgama.com/v2/stable/playgama-bridge.js"></script>
    </head>
    <body>...</body>
</html>
```

When the game launches on a supported platform, Bridge automatically loads the required platform scripts. In unsupported environments, Bridge uses a mock platform and returns safe defaults (`false`, `reject`, etc.) instead of throwing.

#### Initialization

Call the initialization method and wait for it to finish before using any `bridge.*` API.

```javascript
bridge.initialize()
    .then(() => {
        // initialization was successful, SDK can be used
    })
    .catch(error => {
        // error, something went wrong
    })
```

{% endtab %}

{% tab title="Unity" %}

#### Installation

* Open `Window` → `Package Management` → `Package Manager`
* Click the `plus` button and select `Install package from git URL`
* Enter `https://github.com/playgama/bridge-unity.git`
* Open `Playgama` → `Bridge Setup` and click `Add` in the `Add Bridge WebGL Template` section

{% hint style="success" %}
Use the example project as a reference integration:

<https://github.com/playgama/bridge-unity-examples>
{% endhint %}

#### Initialization and Build

The Unity package initializes Bridge automatically while the game loads. No extra initialization call is required.

Select the Bridge WebGL Template before building.

<figure><img src="/files/KZsPcypWAQDeoqM5LWhD" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Construct 3" %}

#### Installation

Download the latest version of `playgama_bridge.c3addon` from the [GitHub release page](https://github.com/playgama/bridge-construct/releases).

Go to `Menu` → `View` → `Addon Manager` and click `Install new addon...`. Select the downloaded file and click `Install` in the popup window.

Open your project, right-click on the `Object types` folder, and select `Add new object type`. Choose `Playgama Bridge` and click `Insert`.

#### Setup

Set `Use Worker` to `No` in the project settings (`Menu` → `Project` → `Properties`).
{% endtab %}

{% tab title="GDevelop" %}

#### Installation

**Release page**

Download the required version of `PlaygamaBridge.json` from the [GitHub release page](https://github.com/playgama/bridge-gdevelop/releases).

Go to `Project Manager` <img src="/files/Du1ZzjB4S5k8Dphq5wSK" alt="" data-size="line"> → `Create or search for new extensions` <img src="/files/XB7Mki8YzFLpxQXf7BL3" alt="" data-size="line"> → `Import extension` <img src="/files/149gLyWhLdsjDaQB5LmA" alt="" data-size="line"> and select the downloaded file.

#### Initialization

Initialization starts automatically. Wait until it completes before running game logic that uses Bridge, such as reading player profile or storage data. Use the **Is Initialized** condition to gate that logic.
{% endtab %}

{% tab title="Godot" %}

#### Integration

Download the latest `playgama_bridge.zip` archive, unzip it, and place the contents into `res://addons`:

* [GitHub releases page](https://github.com/playgama/bridge-godot/releases) for Godot 3
* [GitHub releases page](https://github.com/playgama/bridge-godot-4/releases) for Godot 4

<figure><img src="/files/D2GNBrsjNzLNXT4eWTOv" alt="" width="374"><figcaption></figcaption></figure>

Enable the plugin in the project settings:

<figure><img src="/files/nUuZqYVFhF2EySLGLLvr" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Place Bridge first in the AutoLoad list.
{% endhint %}

#### Initialization

The Godot plugin initializes Bridge automatically while the game loads. No extra initialization call is required.

#### Build

Select the Bridge HTML template in export settings under `Custom HTML Shell`:

```
res://addons/playgama_bridge/template/index.html
```

<figure><img src="/files/ZnQQE6DLJO7mdV1Ke6ZK" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="GameMaker" %}

#### Installation

Download the latest `.yymps` from the [GitHub release page](https://github.com/Playgama/bridge-gamemaker/releases) and import it via `Tools` → `Import Local Package` menu.

<figure><img src="/files/dyVZavQPRy9M4pkhgiAn" alt=""><figcaption><p>Tools → Import Local Package</p></figcaption></figure>

#### Initialization and Build

The GameMaker package initializes Bridge automatically while the game loads. No extra initialization call is required.

Select the Bridge index template before building.

<figure><img src="/files/MiEgkOfiMA7ekLex5UYL" alt=""><figcaption><p>Game Options → HTML5 → General</p></figcaption></figure>
{% endtab %}

{% tab title="Defold" %}

#### Installation

Copy the `Source code.zip` link from the [GitHub release page](https://github.com/Playgama/bridge-defold/releases) and add it as a dependency in your project settings.

<figure><img src="/files/7iy7akZczWVvqD0hFR2y" alt=""><figcaption></figcaption></figure>

Then select `Project` → `Fetch Libraries`.

#### Initialization and Build

The Defold package initializes Bridge automatically while the game loads. No extra initialization call is required.

Select the Bridge index template before building.

<figure><img src="/files/QzMKm2RAKHS4MjSne2oX" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Cocos Creator" %}

#### Installation

Download the latest `.zip` archive from the [GitHub release page](https://github.com/Playgama/bridge-cocos-creator) and import it into your project. Import all files except the optional `Examples` folder. The extension installs `web-mobile` and `preview` templates automatically; you can also run manual installation from `Extensions` → `Playgama Bridge` → `Install`.

<figure><img src="/files/tI0Loxlbj2OHuMvcrKxq" alt=""><figcaption></figcaption></figure>

#### Build Template

{% hint style="danger" %}
Use the `web-mobile` build target. Bridge provides templates for `web-mobile` and `preview` builds.
{% endhint %}

<figure><img src="/files/QU104vKJx9wdqQXv9SQJ" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Scratch" %}

#### Integration

Download `PlaygamaBridge.js` from the [GitHub release page](https://github.com/playgama/bridge-scratch/releases). In TurboWarp, click `Add Extension`, select `Custom Extension`, choose the downloaded file, and enable `Run without sandbox`.

When the game launches on a supported platform, Bridge automatically loads the required platform scripts. In unsupported environments, Bridge uses a mock platform and returns safe defaults (`false`, `reject`, etc.) instead of throwing.

#### Initialization

Call the initialization method and wait for it to finish before using Bridge blocks.

<figure><img src="/files/EpzygJ4FmijzJ7XyHx92" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Required steps

Installation is only the first part of the integration. Every game must also implement the required steps. See the full list with exact methods in [API → Required steps](/playgama/bridge-sdk/api.md#required-steps).
