-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow serializing/deserializing Entity outside World #228
Comments
I think #221 solves this but I'm not sure what idiomatic code looks like using it. (note that this PR isn't part of the last released version) |
Unfortunately it doesn't. The way to serialise registry.with_entity_serializer(|canon| {
run_as_context(canon, || {
// do serialising here...
});
}); This is more or less what the code here does. But with |
I am seeing this as well I'm storing copies of |
Well, in the meantime, I have a workaround for this. Just before serializing, put structs containing entities in the world as single-component entities and serialize as normal. Then remove them from the world. When deserializing extract theses structs and remove them from the world. Note that this workaround does a lot of copying :/ |
When trying to serialise a type that contains an
Entity
reference, outside aWorld
, I get a panic with the error "No entity serializer set". Serializing anEntity
reference requiresrun_as_context
to be called in order to provide the thread-local variable containing theCanon
. This function is private, which means it's not possible to serialize/deserialize any type that containsEntity
if it's not in a component in theWorld
.Could something be added to allow serde of
Entity
outside aWorld
?The text was updated successfully, but these errors were encountered: