-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Bug in World Subscription / Serialization functionality? #127
Comments
On a related note, if I wrote a custom serializer based on Newtonsoft.Json (which I have been using successfully with my own crappy ECS implementation before switching to DefaultEcs), wouldn't that potentially cancel out the limitation regarding circular references of the DefaultEcs serializer? |
That's weird, it seems a lot like a previous issue (#88) which has been fixed a long time ago. I will try to see if I can reproduce it :/
My serializers have some drawback (like the circular reference) but also some perks like being able to serialize absolutely anything, private, readonly even without any attribute decorations on types (which you can't always add on your dependencies). I tried to make it extensible specifically so you can use your own prefered serializer like json if you need to :) |
Thanks for your reply. Since my overall application is fairly complex, I created a minimal reproducible example:
Fortunately (or unfortunately, depending on your point of view) it does not seem to be a problem with my application code. Obviously something's wrong behind the scenes. Glancing over the old issue you linked (#88), I couldn't find anything suspicious-- but you're probably way faster at finding the root of the problem than me anyway. |
Thx for the small repro, I don't understand how it slipped past me and didn't fail earlier. |
You already fixed it? Great! :) And you already updated the NuGet package to 0.16.2? Damn... you're fast. Glad I could help. I already removed all that Thank you very much! |
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 useWorld.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 anUpdateComponent
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.The text was updated successfully, but these errors were encountered: