Description
I'm not sure if it's a bug or if I'm doing something horribly wrong-- please correct me if necessary.
I'm using the integrated TextSerializer
to serialize and deserialize the complete state of my application, and it has been working without problems. At some point though I decided to use World.SubscribeComponentChanged<T>(foobar)
to implement a callback mechanic. I made some quick tests, and the callback mechanic was working just fine. Unfortunately, it broke the serialization mechanic.
The serializer throws an exception and complains about duplicate key entries for each component I register with SubscribeComponentChanged
. If I don't subscribe, everything's working fine again.
Maybe I'm doing something wrong, I don't know. Disposing the subscriptions before serialization doesn't help either, and I couldn't find any relevant information in the documentation.
Can anybody reproduce this issue?
EDIT
To clarify what I'm trying to do here... I want to be notified whenever an entity is changed. I haven't found a way to implement this other than using World.SubscribeComponentChanged<T>(foobar)
. I guess I could also explicitly add an UpdateComponent
or whatever to the entity whenever I change one of its components and create a dedicated system to react properly, but I'd prefer the implicit solution as it would be cleaner and much less error-prone in my opinion.