> For the complete documentation index, see [llms.txt](https://soulslike-framework.isik.vip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soulslike-framework.isik.vip/components-managers/player-specific-components/save-load-manager.md).

# Save/Load Manager

<div align="left"><figure><img src="/files/Pxb9F1D6r6SRb7Q5t5rd" alt=""><figcaption></figcaption></figure></div>

The **Save/Load Manager(AC\_SaveLoadManager)** is a highly versatile component designed to manage all saving and loading operations. It tracks saved data, interacts with the selected save slot stored in the **Game Instance**, and uses **FInstancedStructs** to handle diverse data types. This ensures modularity and flexibility, allowing any type of game data to be saved or loaded seamlessly.

It is added to the **PlayerController** class by default **(PC\_SoulslikeFramework).**

### Functionality

* Works with the **Game Instance** to determine which save slot to handle.
* Utilizes **FInstancedStruct** to save and load any type of data (e.g., stats, inventory, equipment, world state).
  * Converts data into serialized structures for storage and retrieval.
* **Dynamic Save/Load Functionality**:
  * Saves game data dynamically based on the active save slot.
* **Event-Driven Updates**:
  * Dispatches events to notify other components or systems when data is loaded.

### **How It Works**

Main method - **Event UpdateSaveData:** Utilized to add/update our save data. Any type of data can be stored/retrieved in the save file thanks to **Instanced Structures:**

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

Additionally, helper method - **Event AddToSaveData:** Used to add new data to an existing data entry:

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

These events are triggered from various blueprints. If you'd like to see where, see our page related to [Finding References](/getting-started/finding-references.md).

### Saving Components

Each component has a method of "serializing" their data into a savable structure format:

<figure><img src="/files/o4cYWcOE09DIhujRAwb9" alt=""><figcaption><p>Example from AC_EquipmentManager</p></figcaption></figure>

This method adds the related save data to the main data we have in our save/load component. Each component that has data that needs to be saved implements a similar method.&#x20;

Additionally, **AC\_SaveLoadManager** has methods for serializing all of the components.

When the save data inside **AC\_SaveLoadManager** is updated, data will be saved into file.

### Loading Components

The save/load manager sends a message which **each component that requires loading** listens to:

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

When this dispatcher is called, each component that is listening to it will execute a relevant method:

<figure><img src="/files/Uu4huey1u2Zwofcdfdip" alt=""><figcaption><p>Example from AC_InventoryManager</p></figcaption></figure>

### Saving World Actors (Interactables & NPC's)

Actors that need to be saved require a unique identifier. For this, we utilize **GUID's** in Soulslike Framework. Actors without a valid GUID won't be considered for saving:

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

For example, when this container actor (B\_Container) is interacted with, it calls a method to update our save data:

<figure><img src="/files/cjgYZOgLnk4peXlUuPhV" alt=""><figcaption><p>Method screenshot from B_Interactable</p></figcaption></figure>

After our save data has changed/updated, it gets serialized and saved automatically into a file.

### Loading World Actors (Pickup Items, Interactables, NPC's)

Similarly, actors that require loading bind to AC\_SaveLoadManager's **OnDataLoaded()** delegate. This way, when data is loaded, we can execute any desired logic.

<figure><img src="/files/UQ4dDCrXrmBrWTfUcuK1" alt=""><figcaption><p>Load event from B_Interactable</p></figcaption></figure>
