In this code
if (bucket.contains(entity) == false) {
This line is not working.
It makes large list and frame too low.
/// Push an entity into an existing archetype
void putIntoBucket(Entity entity) {
// Add the trait to the new archetype storage
final archetype = entity.archetype;
if (archetype.length > 0) {
if (archetypeBuckets.containsKey(archetype) == false) {
throw Exception('Archetype $archetype is not registered');
}
// Add only if it's not already in the bucket
final bucket = archetypeBuckets[archetype]!;
if (bucket.contains(entity) == false) {
bucket.add(entity);
}
// if necessary add to the non-empty bucket cache
final index = nonEmptyBucketKeys.indexOf(archetype);
if (index == -1) {
nonEmptyBucketKeys.add(archetype);
nonEmptyBucketValues.add(bucket);
}
}
}
In this code
if (bucket.contains(entity) == false) {
This line is not working. It makes large list and frame too low.