Closed Eshnek closed 2 years ago
The reason this happens is because of the order in which components are registered in between the worlds. In the first world, C_Something
is the first thing that gets registered. In the 2nd world, flecs::monitor
is the first thing that gets registered, which as a result gets the same id as the old C_Something
component.
Because component ids are cached in static global variables, the next time you try to use C_Something
, it conflicts with the existing id for flecs::monitor
. The error message is not super clear, I just checked in a fix that changes it to:
component 'C_Something' with symbol 'C_Something' already registered with symbol 'flecs.monitor' (INCONSISTENT_NAME)
The solution for this depends on what you're trying to do. If you have a multi-world application, you'll have to make sure that overlapping components are registered in the same order. If you have an application that creates and deletes worlds multiple times (like sometimes happens in tests), you can use this function to reset component ids:
flecs::reset();
Thank you for the explanation, that makes sense.
Hello!
I recently started with
flecs
and like it a lot so far.I encountered this assertion failure while building unit tests, and have made a small repro:
Repro
Stack Trace
I observe that when
ti->hooks.on_add
is retrieved the function pointer goes to the invalid ctor method, but I don't have a deep enough understanding to debug beyond that yet.Or did I do something wrong?