Saving
This page uses Sprite from Unity. The glossary says what each one is.
The framework keeps your landmarks in its own file rather than in the game’s save, because the game’s save cannot hold a landmark that has no game file behind it.
Things to know
- Your landmarks are saved in a separate file in the save’s mods folder. The file is
obenseuer.moddingframework.landmarks.json. It has one entry for each mod, landmark and map: the mod id, id, title, map, position, icon path (relative to the plugins folder), priority and size. - The game’s own save never holds your landmarks, so removing your mod does not break a save. The game loads with no error. The entries of a mod that is gone stay in the framework’s file but are not drawn, so its markers leave the map, and a reinstall brings them back. (The game’s save keeps a landmark only as an addressable path, which a new landmark does not have. While
SaveController.SaveGameruns, the mod landmarks are taken out of the game’s map list and put back afterwards, even if the save throws.SavingDonefires insideSaveGame, after the game clears its own saving flag but before the finalizer puts the mod landmarks back. That is why aCreate,Mark,RemoveorClearcalled from aSavedhandler is refused while they are detached.) - Your landmarks come back when the game finishes loading the map. The framework adds the saved entries for the loaded map again, without a notification and without firing
Added. - The restore runs only for a mod that is present, which means its
modIdis the GUID of a loaded plugin, or the mod has already calledCreate,Mark,RemoveorClearthis session. The first such call of a session also draws that mod’s other saved entries for the loaded map. This also covers moving between maps in one session. (It runs afterMapController.OnLoadingGameand its 0.7 second delay. A loaded plugin is one inUnityChainloader.Instance.Plugins.) - A landmark made with
Markor with a file icon comes back by itself. - A new game and the main menu empty the list in memory.
- A hand-edited file is checked when it is read. An entry is skipped if it has a bad mod id, id or map, a position that is not a real number, a negative size, or is a repeat. A saved icon path must be relative and stay inside the plugins folder. Any other path is skipped, with one line in the log, so a downloaded save cannot make the game read a file from another machine. (Skipped paths include a network path,
..and another drive.)
Limits
- A landmark made with the
Spriteoverload cannot save its icon, so it comes back only after your mod has calledCreatefor it again that session. - If a mod that is not present has a saved
Spritelandmark, that entry is dropped when the file is read, so it does not use one of the 1024 places.Createthen adds it again at the position your mod gives. - A mod whose
modIdis not its plugin GUID is only counted as present after its first call this session. To be safe, use the plugin GUID asmodId. You can remove your entries, drawn or not, withClear(modId).