Closed keis closed 11 months ago
Thanks for raising this. I pushed a CL which lets you specify resources in SaveFilter
. This should simplify things for you since you don't need to manually deal with the DynamicSceneBuilder
, but you'd still need a custom save pipeline.
But it's still far from an ideal solution. The problem is that we have no way to "mark" resources like we can mark entities with Save
component. On top of that, some Bevy components derive Reflect
but aren't serializable, so I can't rely on types which implement Reflect
either.
I'm thinking of introducing an .add_saved_resource
function to flag and register saved resources in a single call, but this wouldn't be customizable per save pipeline.
I'm gonna keep the issue open until I figure out a better solution to this.
Thanks for the blazing fast fix!
The deny_all()
seems like only sensible default for resources to stick with the philosophy of you explicitly pick want you want to save. Although by a different mechanism. There could for sure be serialisable resources I don't care about from other parts of the system.
I quite liked the of the save pipeline builder which could then have something like a with_resource_filter(.., filter: SceneFilter)
In v0.3.2, you can use save_default().include_resource::<R>().into_file("example.ron")
to include resources into a save pipeline.
I have a project where I want to save specific components and resources.
Components was simple enough to get working by providing my own SaveFilter starting from
deny_all()
(Something like #5 would make this much better!)But I also want to save a resource which led me to create a custom
save()
function with these additional lines.It would be great if moonshine_save could do this out of the box