Question: how to use e.modified() in a query?
nneesshh opened this issue · comments
nneesshh commented
I build a query and iterate the components with each method,
in the each method call back, I update the entity component data and cal "e.modifiyed()",
but it raise an assert because "ecs_table_lock" with the query. How to solve this?
Sander Mertens commented
The assert is protection against accidentally changing the contents the iterator is iterating over. The fix is to defer the operations, which you can do like this:
world.defer_begin();
q.each( ... );
world.defer_end();