VIRTUOS_Docs/sites/codesnippets/SaveGame_SPUD.qmd
2026-01-07 22:07:11 +01:00

18 lines
1.6 KiB
Text

---
title: "SPUD / Save Games"
---
To handle SaveGames and Persistence in Level Streaming, [SPUD](https://github.com/sinbad/SPUD/issues) is used.
The WB_CustomSaveLoadScreen used in the [Main Menu]() is largely based of the [SPUD Examples](https://github.com/sinbad/SPUDExamples) SaveLoadScreen Widget.
Most Variables are passed to the GameInstance, which is especially important for variables that need to exist before the game is loaded, e.g. on the initial Main Menu Map.
::: {.callout-note}
## Note
Saving the GameInstance with SPUD via BP should've been be very straight forward, but I was stuck there for multiple days. Eventually I opened up a [Github-Issue](https://github.com/sinbad/SPUD/issues/139) and it was confirmed that the SPUD Subsystem is not ready on Event Init of the BP GameInstance. I went on implementing going the C++ way, [but a delay until the Subsystem is ready should fix that](https://github.com/sinbad/SPUD/commit/416122438c33f1f7d77d0c319876bf763e58db33).
:::
Pulling Actors into the persistent Levels
As a lot objects in VR are interactible and can therefore easily be moved by the player, it's possible that movable objects leave their streaming level boundary and get despawned when their owning level is unloaded. We have to possibilities to fix that: Having all those objects on the persistent level by default, which isn't ideal from an optimization perspective, or move them to the persistent level when the player actually interacts with them. From my knowledge, there is no *proper* way of changing the owning level at runtime but destroying and respawning the actor, which isn't always ideal.