sinbad / SPUD

Steve's Persistent Unreal Data library
MIT License
300 stars 44 forks source link

Actor Component Saving #47

Closed DPursey0 closed 1 year ago

DPursey0 commented 1 year ago

I have run some small tests with very rudimentary actors and actor components trying to get SPUD to automatically pick up savegame uproperties on actor components implementing ISpudObject, but I haven't found any success. I've tried implementing ISpudObject on my actor component, but so far, the only thing that worked was writing some custom serialization on the actor to grab the data from the actor component. Ideally, I want to avoid having to write custom serialization for every actor with data in its components.

Is there currently any support for adding data from actor components to a save and if not, is there any plans to support it in the future?

sinbad commented 1 year ago

No, please see the Component section of the Properties docs. It's possible we might support components in future, perhaps as an opt-in because it's expensive to cascade into every component of every actor when you don't need to. However I've no specific plans right now.

sinbad commented 1 year ago

Note the partial support for components though:

For any components you wish to be persisted, you must:

  1. Hold a reference to them in a root object UPROPERTY, marked as SaveGame
  2. Instantiate those components at construction time

This works because you're explicitly including the component in the actor as SaveGame. There's no support for cascading through all (nested) components looking for SaveGame otherwise though.