> For the complete documentation index, see [llms.txt](https://visualonecompany.gitbook.io/storyframeworkdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://visualonecompany.gitbook.io/storyframeworkdocs/core-components/saving-loading/saving-custom-values/saving-actor-data.md).

# Saving Actor Data

Any actor that is required to save **any** form of data is required to contain the `SFActorSavable_AC` actor component attached to it. This actor component is responsible for storing a unique `SaveID` , as well as loading any data saved to that unique ID upon said actor beginning play (I.e. immediately or when it is loaded in). \
\
Most SF actors already contain this actor component. You might notice errors appearing when placing any type of SF actor into the scene stating that it does not contain a unique `SaveID`. Generally, this is fixed by simply saving any unsaved packaged (pressing Ctrl + S). Alternatively, you'll find a "Refresh all Save ID's" button which will generate a unique Save ID for any actor that doesn't already have one (only applies to actors currently loaded).

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FuuW6VyhbPCPRHOiP3M72%2Fimage.png?alt=media&amp;token=7929fd77-4d40-4a41-86bf-60f4a32b2727" alt=""><figcaption></figcaption></figure></div>

***

Though SF does save the more common actor attributes (destroyed, components, etc), some custom interactables might need custom save behaviour. For instance; a television that needs to potentially save and load the channel it was last on when the player had saved & exited.\
\
SF includes a simple workflow to solve custom actor save logic through the use of the `Save Actor Data String` function, and the receiving `LoadFromDataString` interface event.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FH4JF4CQhmJsPqgxUtyBh%2FSaveActorDataString.png?alt=media&amp;token=293da15a-4f3a-4754-b349-6ba231adf9f2" alt=""><figcaption></figcaption></figure></div>

Whenever your actor performs logic and reaches a "static" point (for example, a door plays an open and close animation, but is completely "static" when its fully opened or closed. A lever could use a movement animation, but is completely "static" when that movement animation is completed. etc etc), we'd make use of the `Save Actor Data String` function to store a string that acts as your actors current "state". An actor can only contain a single saved data string at a time. Every time the `Save Actor Data String` function is called, it will override any existing saved data string.\
\
Once your state is saved, implement the `LoadFromDataString` BPI event (From the `SFInteraction_BPI`) into your actors event graph, and re-execute logic relevant to the `Data String` or "state" you previously saved. You can use a `Switch on String` in cases like these.

<div align="left"><figure><img src="https://2310584459-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuiMQl6UzBr8OnuaoaiWO%2Fuploads%2FfvtY3WmQqB56lwsI2otV%2FSwitchOnDataString.png?alt=media&amp;token=9abb9d8b-b96b-4724-adac-8854d80cb57b" alt=""><figcaption></figcaption></figure></div>

***

{% hint style="info" icon="gear" %}
To make use of this workflow, your actor must contain the `SFActorSavable_AC` actor component, as well as implement the `SFInteraction_BPI` blueprint interface.
{% endhint %}
