> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/2.2/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.loadstatefromplayerprefs.md).

# LoadStateFromPlayerPrefs(string)

Method in [DialogueRunner](/2.2/api/csharp/yarn.unity/yarn.unity.dialoguerunner.md)

## Summary

Loads all variables from the `PlayerPrefs` object into the Dialogue Runner's variable storage.

```csharp
public bool LoadStateFromPlayerPrefs(string SaveKey = "YarnBasicSave")
```

## Remarks

This method loads a string containing JSON from the `PlayerPrefs` object under the key `SaveKey`, deserializes that JSON, and then uses the resulting object to set all variables in [VariableStorage](/2.2/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.variablestorage.md).

The loaded information can be stored via the [SaveStateToPlayerPrefs(string)](/2.2/api/csharp/yarn.unity/yarn.unity.dialoguerunner/yarn.unity.dialoguerunner.savestatetoplayerprefs.md) method.

## Parameters

| Name             | Description                                |
| ---------------- | ------------------------------------------ |
| `string` SaveKey | The key to use when storing the variables. |

## Returns

`true` if the variables were successfully loaded from the player preferences; `false` otherwise.

## See Also

* VariableStorageBehaviour.SetAllVariables(Dictionary\<string, float>, Dictionary\<string, string>, Dictionary\<string, bool>, bool)
