sinbad / SPUD

Steve's Persistent Unreal Data library
MIT License
342 stars 51 forks source link

Documentation On Saving/Loading Runtime Spawned AI Characters? #78

Closed dyanikoglu closed 3 months ago

dyanikoglu commented 3 months ago

Hi. Is there any example on how to save AI characters spawned in runtime with AI controllers, and load the characters back by possessing them with the same controller?

Since the documentation assumes characters as game framework spawned actors, this doesn't fit to our use case.

sinbad commented 3 months ago

I haven't tried it but if anything it should be simpler than game framework spawned characters, the whole reason that's talked about in the docs is that it can be a pain. AI actors are much simpler, maybe use a post restore to set them back up if you need to.

sinbad commented 3 months ago

FWIW since controllers are usually stateless you could only save the actor character and re-create the controller on load (auto possess on begin play may even do that for you)

dyanikoglu commented 3 months ago

Yes, I was also thought about the same after creating this issue!

Respawning controller in AI character's SpudRestoreCustomData and posessing the character worked pretty fine :)