# Saving Variable Values

If you enter play mode, and press the button “End Tutorial”, you will see that the Tutorial object will disable itself. &#x20;

Now exit play mode and play again. You can see that the changes have persisted. It’s because the example\_bool\_tutorialCompleted variable state has been saved to Player Prefs. To enable saving on your variable, select the variable and enable the property “Saved”. All scriptable variables available in the package can be saved to Player Prefs with a single click. (Except the GameObjectVariable). &#x20;

When loaded for the first time, the variable will be set to the Default Value.&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeL8EstQ_QxgT84GX5L1YBE0mYtmWVr1g2pe01k3hBHX8MVUlTokopfA8-LOMQU6QkqGLkN6sk5ItVflqIgJqOub171BU_ni6xTYCoqsYCEEEGRl3_uxs7Ux-FyIFE3D3OuWwHlyBcQTB-0hw8X6zxHLrA?key=ZJq93Y9COvgDvT7H30W5KQ" alt="" width="375"><figcaption></figcaption></figure>

The key used for Player Prefs is the Save Guid of the ScriptableVariable. This Guid is generated using the path of the asset. If Auto is selected, the Guid is generated automatically. If you change it to Manual, you can override the Guid.&#x20;

You can use the fact that a variable has been saved in combination with a Binding script. If you select the Tutorial in the scene, you can see that its component BindComparisonToUnityEvent will disable the object if the condition is true. Bindings are explained in the next scene.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXckiZFXm7X4uZLJZupX8XG5WsV1Q_ESYbtJZNt_jtaO38lfWvc-ua0ez_iGtxZkEszqG5jE0MtlZTKx6y4KFsNv3IGAE7cl-H1ZKXXXvnE0YzqL-ykI-qdT-ZvOhJyYrriOvn4-R7bsfCKf4XWmnrfqRd4?key=ZJq93Y9COvgDvT7H30W5KQ" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfhrqzqW-YhwMB1d_gYJ6hx5O7lWeTt-8ekFkiT6MWpErC7alJgyDCx-yZE9EA5HI9VgKJy9Vopl3afM67tkHNY2f1y_8x7Ey58jKaQT1DEyfEdB-ch6aP1UBfeEv6HjcVf6d4eHc4LkNQ3sPoDQ7HsEgs?key=ZJq93Y9COvgDvT7H30W5KQ" alt="" width="375"><figcaption></figcaption></figure>

The player position is also saved, check the PositionSaver.cs on the prefab\_player in the scene.&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdfciS4O1I8_HtVu1li9lPWUGsjRfj7EPNMdEW7ErsmC6hHBtismUCAm_BdA2ISBAwufalu1LBd5iw9s_KFHXaqwtv83KEavJjgNi4kW04UsSL168WovQQtIoi17F6ewp3_yozA7YnkM0RYXzziB1Mfd7Q7?key=ZJq93Y9COvgDvT7H30W5KQ" alt="" width="375"><figcaption></figcaption></figure>

Saving variables like this is useful for things like level index, player score, coins, tutorials completed, etc. For a more complex and bigger save system, please check the 5\_ScriptableSave\_Example\_Scene and its [documentation](/soap/scene-documentation/5_scriptablesaves.md).

If you want to clear the variables save (deleting all Player Prefs), use the shortcut (CTRL+Shift+D) or the menu item:&#x20;

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcpoS5-x_9Sz42i2-9--18JLQCWuAU_JPYbNY85qa7SiJJbtnOXgjuYfuLTT13ufGTnhjmnKJiSmEZ6zKxU23JhgBwkiApowChjj-6IJbWVFRfvhRCUCy4jTGBgxtCoRCry0TYjAWlAVQSBYLr-Nuu5O0E?key=ZJq93Y9COvgDvT7H30W5KQ" alt="" width="375"><figcaption></figcaption></figure>


---

# 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://obvious-game.gitbook.io/soap/scene-documentation/1_scriptablevariables/saving-variable-values.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.
