# Storage

The Storage module persists player data: progress, settings, currency, level state. **This is required for almost every game.** Without it, players lose progress between sessions.

### Two storage types

| Type                | Persistence                 | Cross-device | Use when                                            |
| ------------------- | --------------------------- | ------------ | --------------------------------------------------- |
| `local_storage`     | Browser/device localStorage | No           | Default for offline, single-device progress         |
| `platform_internal` | Platform cloud servers      | Yes          | Player is authorized and you want cross-device save |

`bridge.storage.defaultType` returns the storage type preferred by the current platform. Use it by default; pass an explicit `storageType` only when you need to control where the data is stored.

### Implementation order

1. **Required** — On game start, call [`storage.get(...)`](#load-data) for the keys you need (`level`, `coins`, `settings`, etc.). Restore the player's state before showing gameplay.
2. **Required** — On meaningful state change (level complete, purchase, settings change), [`storage.set(...)`](#save-data) to persist. Avoid saving every frame.

#### Current Storage Type <a href="#current-storage-type" id="current-storage-type"></a>

Read the default storage type before saving data. It tells you whether Bridge will use local browser storage or platform cloud storage.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.storage.defaultType
```

{% endtab %}

{% tab title="Unity" %}

```java
Bridge.storage.defaultType
```

{% endtab %}

{% tab title="Construct 3" %}

```javascript
PlaygamaBridge.DefaultStorageType
```

{% endtab %}

{% tab title="GDevelop" %}

```javascript
PlaygamaBridge::DefaultStorageType()
```

{% endtab %}

{% tab title="Godot" %}

```gdscript
Bridge.storage.default_type
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_storage_default_type()
```

{% endtab %}

{% tab title="Defold" %}

```lua
bridge.storage.default_type()
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.storage.defaultType
```

{% endtab %}

{% tab title="Scratch" %}

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

Possible values: `local_storage`, `platform_internal`.

#### Availability Check <a href="#availability-check" id="availability-check"></a>

Check whether a storage type is available before forcing it explicitly. Availability can depend on platform support and player authorization.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.storage.isAvailable(storageType)
```

{% endtab %}

{% tab title="Unity" %}

```java
Bridge.storage.IsAvailable(StorageType.LocalStorage)
Bridge.storage.IsAvailable(StorageType.PlatformInternal)
```

{% endtab %}

{% tab title="Construct 3" %}

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

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"is-storage-available","objectClass":"PlaygamaBridge","parameters":{"storage-type":"local-storage"}}],"actions":[{"type":"comment","text":"local storage available"}]},{"eventType":"block","conditions":[{"id":"is-storage-available","objectClass":"PlaygamaBridge","parameters":{"storage-type":"platform-internal"}}],"actions":[{"type":"comment","text":"platform internal available"}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}

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

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsStorageAvailable"},"parameters":["","\"platform_internal\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Platform internal storage available\"","\"info\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsStorageAvailable"},"parameters":["","\"local_storage\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Local storage available\"","\"info\"",""]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[{"type":{"value":"PlaygamaBridge::IsStorageSupported"},"parameters":["","\"local_storage\"",""]}],"conditionsCount":1}}
```

</details>
{% endtab %}

{% tab title="Godot" %}

```gdscript
Bridge.storage.is_available("local_storage")
Bridge.storage.is_available("platform_internal")

# To use constants for convenience:
Bridge.storage.is_available(Bridge.StorageType.LOCAL_STORAGE)
Bridge.storage.is_available(Bridge.StorageType.PLATFORM_INTERNAL)
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_storage_is_available("platform_internal")
```

{% endtab %}

{% tab title="Defold" %}

```lua
bridge.storage.is_available("local_storage")
bridge.storage.is_available("platform_internal")
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.storage.isAvailable(STORAGE_TYPE.PLATFORM_INTERNAL)
bridge.storage.isAvailable(STORAGE_TYPE.LOCAL_STORAGE)
```

{% endtab %}

{% tab title="Scratch" %}

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

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Load Data <a href="#load-data" id="load-data"></a>

Load one key or several keys before gameplay starts. Missing keys return `null`, so always provide defaults in your game state.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
// Load data by key
bridge.storage.get('key')
    .then(data => {
        // Data loaded and you can work with it
        // data = null if there is no data for the given key
        console.log('Data: ', data)
    })
    .catch(error => {
        // Error, something went wrong
    })

// Load data by multiple keys
bridge.storage.get(['key_1', 'key_2'])
    .then(data => {
        // Data loaded and you can work with it
        // data[n] = null if there is no data for the given key
        console.log('Data: ', data)
    })
    .catch(error => {
        // Error, something went wrong
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
// Get data by key
private void Start()
{
    Bridge.storage.Get("level", OnStorageGetCompleted);
}

private void OnStorageGetCompleted(bool success, string data)
{
    // Loading succeeded
    if (success)
    {
        if (data != null)
        {
            Debug.Log(data);
        }
        else
        {
            // No data for the key 'level'
        }
    }
    else
    {
        // Error, something went wrong
    }
}

// Get data by multiple keys
private void Start()
{
    Bridge.storage.Get(new List<string>() { "level", "coins" }, OnStorageGetCompleted);
}

private void OnStorageGetCompleted(bool success, List<string> data)
{
    // Loading succeeded
    if (success)
    {
        if (data[0] != null)
        {
            Debug.Log($"Level: {data[0]}");
        }
        else
        {
            // No data for the key 'level'
        }

        if (data[1] != null)
        {
            Debug.Log($"Coins: {data[1]}");
        }
        else
        {
            // No data for the key 'coins'
        }
    }
    else
    {
        // Error, something went wrong
    }
}

// Get data from a specific storage type
private void Start()
{
    Bridge.storage.Get("level", OnStorageGetCompleted, StorageType.LocalStorage);
}

private void OnStorageGetCompleted(bool success, string data)
{
    // Loading succeeded
    if (success)
    {
        if (data != null)
        {
            Debug.Log(data);
        }
        else
        {
            // No data for the key 'level'
        }
    }
    else
    {
        // Error, something went wrong
    }
}
```

{% endtab %}

{% tab title="Construct 3" %}

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

{% hint style="info" %}
If you need data in JSON format, use the `PlaygamaBridge.StorageDataAsJSON("key_1")` expression.
{% endhint %}

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"append-storage-data-get-request","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_1\""}},{"id":"append-storage-data-get-request","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_2\""}},{"id":"send-storage-data-get-request","objectClass":"PlaygamaBridge","parameters":{"storage-type":"default"}}]},{"eventType":"block","conditions":[{"id":"on-storage-data-get-request-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"has-storage-data","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_1\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.StorageData(\"key_1\")"}}]},{"eventType":"block","conditions":[{"id":"has-storage-data","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_2\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.StorageData(\"key_2\")"}}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}

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

{% hint style="info" %}
If you need data in JSON format, use the `PlaygamaBridge::StorageDataKeyAsJSON("key_1")` expression.
{% endhint %}

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AppendStorageDataGetRequest"},"parameters":["","\"key_1\"",""]},{"type":{"value":"PlaygamaBridge::AppendStorageDataGetRequest"},"parameters":["","\"key_2\"",""]},{"type":{"value":"PlaygamaBridge::SendStorageDataGetRequest"},"parameters":["","\"default\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnStorageDataGetRequestCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::HasStorageData"},"parameters":["","\"key_1\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::StorageDataKey(\"key_1\")","\"info\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::HasStorageData"},"parameters":["","\"key_2\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::StorageDataKey(\"key_2\")","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
# Load data by key
func _ready():
    Bridge.storage.get("level", funcref(self, "_on_storage_get_completed"))

func _on_storage_get_completed(success, data):
    if success:
        if data != null:
            print(data)
        else:
            # No data for the key 'level'
            print("Data is null")

# Load data by multiple keys
func _ready():
    Bridge.storage.get(["level", "coins"], funcref(self, "_on_storage_get_completed"))

func _on_storage_get_completed(success, data):
    if success:
        if data[0] != null:
            print("Level: ", data[0])
        else:
            # No data for the key 'level'
            print("Level is null")

        if data[1] != null:
            print("Coins: ", data[1])
        else:
            # No data for the key 'coins'
            print("Coins is null")

# Load data from a specific storage type
Bridge.storage.get("level", funcref(self, "_on_storage_get_completed"), Bridge.StorageType.LOCAL_STORAGE)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
# Load data by key
func _ready():
    Bridge.storage.get("level", Callable(self, "_on_storage_get_completed"))

func _on_storage_get_completed(success, data):
    if success:
        if data != null:
            print(data)
        else:
            # No data for the key 'level'
            print("Data is null")

# Load data by multiple keys
func _ready():
    Bridge.storage.get(["level", "coins"], Callable(self, "_on_storage_get_completed"))

func _on_storage_get_completed(success, data):
    if success:
        if data[0] != null:
            print("Level: ", data[0])
        else:
            # No data for the key 'level'
            print("Level is null")

        if data[1] != null:
            print("Coins: ", data[1])
        else:
            # No data for the key 'coins'
            print("Coins is null")

# Load data from a specific storage type
Bridge.storage.get("level", Callable(self, "_on_storage_get_completed"), Bridge.StorageType.LOCAL_STORAGE)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
// Load data by key
var keys = ["coins", "level"]
playgama_bridge_storage_get(json_stringify(keys))

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_storage_get_callback" {
    if async_load[? "success"] {
        var values = json_parse(async_load[? "data"])
        var coins = values[0]
        var level = values[1]

        if is_undefined(coins) {
            // there is no stored data for key "coins"
        }

        if is_undefined(level) {
            // there is no stored data for key "level"
        }
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)	
	bridge.storage.get(
		{ "coins", "level" }, 
		function (_, data)
			if data.coins then
				print("Coins: ", data.coins)
			end
			if data.level then
				print("Level: ", data.level)
			end
		end, 
		function ()
			-- error
		end
	)
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
// Load data by key
bridge.storage.get('key')
    .then(data => {
        // Data loaded and you can work with it
        // data = null if there is no data for the given key
        console.log('Data: ', data)
    })
    .catch(error => {
        // Error, something went wrong
    })

// Load data by multiple keys
bridge.storage.get(['key_1', 'key_2'])
    .then(data => {
        // Data loaded and you can work with it
        // data[n] = null if there is no data for the given key
        console.log('Data: ', data)
    })
    .catch(error => {
        // Error, something went wrong
    })
```

{% endtab %}

{% tab title="Scratch" %}

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

#### <img src="/files/qkRz0XouRMuwHLVog6j8" alt="" data-size="line"> Save Data <a href="#save-data" id="save-data"></a>

Save one key or several keys after meaningful progress changes, such as level completion, purchase, currency change, or settings update.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
// Save data by key
bridge.storage.set('key', 'value')
    .then(() => {
        // Data successfully saved
    })
    .catch(error => {
        // Error, something went wrong
    })

// Save data by multiple keys
bridge.storage.set(['key_1', 'key_2'], ['value_1', 'value_2'])
    .then(() => {
        // Data successfully saved
    })
    .catch(error => {
        // Error, something went wrong
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
// Save data by key
private void Start()
{
    Bridge.storage.Set("level", "dungeon_123", OnStorageSetCompleted);
}

private void OnStorageSetCompleted(bool success)
{
    Debug.Log($"OnStorageSetCompleted, success: {success}");
}

// Save data by multiple keys
private void Start()
{
    var keys = new List<string>() { "level", "is_tutorial_completed", "coins" };
    var data = new List<object>() { "dungeon_123", true, 12 };
    Bridge.storage.Set(keys, data, OnStorageSetCompleted);
}

// Save data to a specific storage type
private void Start()
{
    Bridge.storage.Set("level", "dungeon_123", OnStorageSetCompleted, StorageType.LocalStorage);
}
```

{% endtab %}

{% tab title="Construct 3" %}

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

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"append-storage-data-set-request","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_1\"","value":"42"}},{"id":"append-storage-data-set-request","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_2\"","value":"\"test\""}},{"id":"send-storage-data-set-request","objectClass":"PlaygamaBridge","parameters":{"storage-type":"default"}}]},{"eventType":"block","conditions":[{"id":"on-storage-data-set-request-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"success"}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}

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

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AppendStorageDataSetRequest"},"parameters":["","\"key_1\"","\"42\"",""]},{"type":{"value":"PlaygamaBridge::AppendStorageDataSetRequest"},"parameters":["","\"key_2\"","\"test\"",""]},{"type":{"value":"PlaygamaBridge::SendStorageDataSetRequest"},"parameters":["","\"default\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnStorageDataSetRequestCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Data Saved!\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
# Save data by key
func _ready():
    Bridge.storage.set("level", "dungeon_123", funcref(self, "_on_storage_set_completed"))

func _on_storage_set_completed(success):
    print("On Storage Set Completed, success: ", success)

# Save data by multiple keys
Bridge.storage.set(["level", "is_tutorial_completed", "coins"], ["dungeon_123", true, 42], funcref(self, "_on_storage_set_completed"))

# Save data to a specific storage type
Bridge.storage.set("level", "dungeon_123", funcref(self, "_on_storage_set_completed"), Bridge.StorageType.LOCAL_STORAGE)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
# Save data by key
func _ready():
    Bridge.storage.set("level", "dungeon_123", Callable(self, "_on_storage_set_completed"))

func _on_storage_set_completed(success):
    print("On Storage Set Completed, success: ", success)

# Save data by multiple keys
Bridge.storage.set(["level", "is_tutorial_completed", "coins"], ["dungeon_123", true, 42], Callable(self, "_on_storage_set_completed"))

# Save data to a specific storage type
Bridge.storage.set("level", "dungeon_123", Callable(self, "_on_storage_set_completed"), Bridge.StorageType.LOCAL_STORAGE)

```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
var keys = ["coins", "level"]
var values = [42, "dungeon"]
playgama_bridge_storage_set(json_stringify(keys), json_stringify(values))

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_storage_set_callback" {
    if async_load[? "success"] {
        // your logic
    }
}
```

{% endtab %}

{% tab title="Defold" %}

<pre class="language-lua"><code class="lang-lua">local bridge = require("bridge.bridge")

function init(self)	
<strong>	bridge.storage.set(
</strong>		{ coins = 42, level = "dungeon" }, 
		function (_)
			-- success
		end, 
		function (_)
			-- error
		end
	)	
end
</code></pre>

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
// Save data by key
bridge.storage.set('key', 'value')
    .then(() => {
        // Data successfully saved
    })
    .catch(error => {
        // Error, something went wrong
    })

// Save data by multiple keys
bridge.storage.set(['key_1', 'key_2'], ['value_1', 'value_2'])
    .then(() => {
        // Data successfully saved
    })
    .catch(error => {
        // Error, something went wrong
    })
```

{% endtab %}

{% tab title="Scratch" %}

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

#### Delete Data <a href="#delete-data" id="delete-data"></a>

Delete one key or several keys when you intentionally reset progress, clear settings, or migrate obsolete data.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
// Delete data by key
bridge.storage.delete('key')
    .then(() => {
        // Data successfully deleted
    })
    .catch(error => {
        // Error, something went wrong
    })

// Delete data by multiple keys
bridge.storage.delete(['key_1', 'key_2'])
    .then(() => {
        // Data successfully deleted
    })
    .catch(error => {
        // Error, something went wrong
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
// Delete data by key
private void Start()
{
    Bridge.storage.Delete("level", OnStorageDeleteCompleted);
}

private void OnStorageDeleteCompleted(bool success)
{
    Debug.Log($"OnStorageDeleteCompleted, success: {success}");
}

// Delete data by multiple keys
private void Start()
{
    var keys = new List<string>() { "level", "is_tutorial_completed", "coins" };
    Bridge.storage.Delete(keys, OnStorageDeleteCompleted);
}

// Delete data from a specific storage type
private void Start()
{
    Bridge.storage.Delete("level", OnStorageDeleteCompleted, StorageType.LocalStorage);
}
```

{% endtab %}

{% tab title="Construct 3" %}

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

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"append-storage-data-delete-request","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_1\""}},{"id":"append-storage-data-delete-request","objectClass":"PlaygamaBridge","parameters":{"key":"\"key_2\""}},{"id":"send-storage-data-delete-request","objectClass":"PlaygamaBridge","parameters":{"storage-type":"default"}}]},{"eventType":"block","conditions":[{"id":"on-storage-data-delete-request-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"success"}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}

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

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AppendStorageDataDeleteRequest"},"parameters":["","\"key_1\"",""]},{"type":{"value":"PlaygamaBridge::AppendStorageDataDeleteRequest"},"parameters":["","\"key_2\"",""]},{"type":{"value":"PlaygamaBridge::SendStorageDataDeleteRequest"},"parameters":["","\"default\"",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnStorageDataDeleteRequestCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Data Deleted!\"","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
# Delete data by key
func _ready():
    Bridge.storage.delete("level", funcref(self, "_on_storage_delete_completed"))

func _on_storage_delete_completed(success):
    print("On Storage Delete Completed, success: ", success)

# Delete data by multiple keys
Bridge.storage.delete(["level", "is_tutorial_completed", "coins"], funcref(self, "_on_storage_delete_completed"))

# Delete data from a specific storage type
Bridge.storage.delete("level", funcref(self, "_on_storage_delete_completed"), Bridge.StorageType.LOCAL_STORAGE)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
# Delete data by key
func _ready():
    Bridge.storage.delete("level", Callable(self, "_on_storage_delete_completed"))

func _on_storage_delete_completed(success):
    print("On Storage Delete Completed, success: ", success)

# Delete data by multiple keys
Bridge.storage.delete(["level", "is_tutorial_completed", "coins"], Callable(self, "_on_storage_delete_completed"))

# Delete data from a specific storage type
Bridge.storage.delete("level", Callable(self, "_on_storage_delete_completed"), Bridge.StorageType.LOCAL_STORAGE)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
var keys = ["coins", "level"]
playgama_bridge_storage_delete(json_stringify(keys))

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_storage_delete_callback" {
    if async_load[? "success"] {
        // your logic
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)	
	bridge.storage.delete(
		{ "coins", "level" }, 
		function ()
			-- success
		end, 
		function ()
			-- error
		end
	)
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
// Delete data by key
bridge.storage.delete('key')
    .then(() => {
        // Data successfully deleted
    })
    .catch(error => {
        // Error, something went wrong
    })

// Delete data by multiple keys
bridge.storage.delete(['key_1', 'key_2'])
    .then(() => {
        // Data successfully deleted
    })
    .catch(error => {
        // Error, something went wrong
    })
```

{% endtab %}

{% tab title="Scratch" %}

<figure><img src="/files/3zrEZkLiTUtisKmHSzMH" alt=""><figcaption></figcaption></figure>
{% 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/api/storage.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.
