Closed notinmybackyaard closed 1 month ago
Hi, I definitely wouldn't say it's normal to get to the else
block.
In theory you should almost only enter the if
block. You add an entity or component and there is no component in the storage.
The else if
block can be entered in normal scenarios if you override a component, entity.gen() == sparse_entity.gen()
. This block can also trigger for a less normal execution when entity.gen() > sparse_entity.gen()
, that would mean you didn't deleted all components of an entity. It's still okay.
The else
block is accessed when you have an entity1
, you delete entity1
and create a new entity2
. Then you add component T
to entity2
and then try to add component T
to entity1
.
Of course it could be a bug in shipyard
, hopefully not.
Okay, I'll check my whole logic, thx!
Hello leudz,
I am using Shipyard 0.6.2 and have a question about it. In the sparse_set/mod.rs file, there is an insert function in the SparseSet. In the code, under what circumstances does the else statement get executed? Is this scenario considered normal? To track if there is a case where the insert function is called but data is not added, I inserted panic code, and although I'm not exactly sure about the scenario, the panic occurred at that point, which is why I'm asking.