# Setup

## Integration steps <a href="#integration-steps" id="integration-steps"></a>

Use this order for a new integration:

1. Install the Bridge package for your engine.
2. Create or update `playgama-bridge-config.json` in the [config editor](https://playgama.github.io/bridge-config-editor/).
3. Wait for Bridge initialization before calling SDK APIs.
4. Read `platform.language` and apply localization.
5. Load saved progress with `storage.get(...)`.
6. Send `platform.sendMessage('game_ready')` when the first playable frame is ready.
7. Add interstitial ads at natural pauses, such as level transitions or game over.

{% 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.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Integration <a href="#integration" id="integration"></a>

Add the script from CDN:

```html
<html>
    <head>
        <script src="https://bridge.playgama.com/v1/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.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config <a href="#config" id="config"></a>

Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update `playgama-bridge-config.json`. This file stores SDK settings: platform identifiers, in-game purchases, ad placements and more.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Initialization <a href="#initialization" id="initialization"></a>

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" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Installation <a href="#installation" id="installation"></a>

* 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 %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config <a href="#config" id="config"></a>

`WebGLTemplates/Bridge/playgama-bridge-config.json` stores SDK settings: platform identifiers, in-game purchases, ad placements and more. Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update it.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> **Initialization and Build** <a href="#initialization-and-build" id="initialization-and-build"></a>

{% hint style="info" %}
Enable `Decompression Fallback` in Unity build settings before building WebGL.
{% endhint %}

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

Select the Bridge WebGL Template before building.
{% endtab %}

{% tab title="Construct 3" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> 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`.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Setup <a href="#setup" id="setup"></a>

1. Set `Use Worker` to `No` in the project settings:

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config <a href="#config" id="config"></a>

Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update `playgama-bridge-config.json`, then import it into the `Files` folder. This file stores SDK settings: platform identifiers, in-game purchases, ad placements and more.

{% hint style="warning" %}
When updating the plugin, review and save `playgama-bridge-config.json` in the [config editor](https://playgama.github.io/bridge-config-editor/).
{% endhint %}
{% endtab %}

{% tab title="GDevelop" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Installation

**GDevelop IDE**

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"> → type `Playgama Bridge` in the `Search extensions` field and install the extension.

<figure><img src="/files/9dq5jIS6qoit9uRw2OoC" alt=""><figcaption></figcaption></figure>

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

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config

Open the `Playgama Bridge` extension in the editor.

Select the `onFirstSceneLoaded` function. Configure SDK settings there: platform identifiers, in-game purchases, ad placements and more. Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update the configuration.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Initialization

Initialization starts automatically. Wait until it completes before running game logic that uses Bridge, such as reading player profile or storage data.
{% endtab %}

{% tab title="Godot" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Integration <a href="#integration" id="integration"></a>

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

Enable the plugin in the project settings:

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

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config <a href="#config" id="config"></a>

`addons/playgama_bridge/template/playgama-bridge-config.json` stores SDK settings: platform identifiers, in-game purchases, ad placements and more. Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update it.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Initialization <a href="#initialization" id="initialization"></a>

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

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Build

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

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

{% endtab %}

{% tab title="GameMaker" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> 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.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config

`datafiles/playgama-bridge-config.json` stores SDK settings: platform identifiers, in-game purchases, ad placements and more. Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update it.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> 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.
{% endtab %}

{% tab title="Defold" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> 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.

Then select `Project` → `Fetch Libraries`.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config

Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update `playgama-bridge-config.json`. Import it into `res/web` and add the `/res` folder to `Bundle Resources`. This file stores SDK settings: platform identifiers, in-game purchases, ad placements and more.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> 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.
{% endtab %}

{% tab title="Cocos Creator" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Installation <a href="#installation" id="installation"></a>

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 <a href="#config" id="config"></a>

{% 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>

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config <a href="#config" id="config"></a>

`extensions/playgama-bridge/playgama-bridge-config.json` stores SDK settings: platform identifiers, in-game purchases, ad placements and more. Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update it.

Use the `web-mobile` build target for publishing.

{% hint style="warning" %}
`playgama-bridge-config.json` is copied automatically from the extension folder to the `web-mobile` build folder after each build.
{% endhint %}
{% endtab %}

{% tab title="Scratch" %}

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> 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.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Config <a href="#config" id="config"></a>

Use the [config editor](https://playgama.github.io/bridge-config-editor/) to create or update `playgama-bridge-config.json`, then add it to your project. This file stores SDK settings: platform identifiers, in-game purchases, ad placements and more.

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Initialization <a href="#initialization" id="initialization"></a>

Call the initialization method and wait for it to finish before using Bridge blocks.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.playgama.com/playgama/sdk/setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
