How can I save the Static Mesh property of an FGBuildable component?
Hi, I'm making a buildable for Factory Props that allows the player to customize a character model, and you can select which helmet mesh to use from a UI. This triggers a "Set Static Mesh" node on the StaticMesh component of the building. The problem is that the selected mesh does not save, and is set to the default one after a reload. I've read through the save system documentation, but I'm not sure how to add a
SaveGame
flag, though I did override the ShouldSave
function as instructed.
Solution:


Jump to solution
Alternate method: Linear motion does this by putting the selectable meshes into a map and saving the selected string.




2 Replies
While I think adding SaveGame to a property at runtime is possible, I don't think it's safe
You can add a component to the playerstate using SCS hooks and store the mesh to use there as a savegame property, then apply it on load
Solution



Alternate method: Linear motion does this by putting the selectable meshes into a map and saving the selected string.



