@@ -15696,6 +15696,7 @@ void flecs_emit_forward_table_up(
1569615696 const EcsParent *parent = ecs_get(world, tgt, EcsParent);
1569715697 ecs_assert(parent != NULL, ECS_INTERNAL_ERROR, NULL);
1569815698 ecs_assert(parent->value != 0, ECS_INTERNAL_ERROR, NULL);
15699+
1569915700 cr = flecs_components_get(world, ecs_childof(parent->value));
1570015701 ecs_assert(cr != NULL, ECS_INTERNAL_ERROR, NULL);
1570115702 }
@@ -16242,8 +16243,7 @@ void flecs_emit(
1624216243
1624316244 for (p = 0; p < parent_count; p ++) {
1624416245 ecs_entity_t parent = parents[p].value;
16245- ecs_assert(parent != 0, ECS_INTERNAL_ERROR, NULL);
16246- if (flecs_entities_is_alive(world, parent)) {
16246+ if (parent && flecs_entities_is_alive(world, parent)) {
1624716247 ecs_id_t pair = ecs_childof(parent);
1624816248 ecs_type_t type = { .count = 1, .array = &pair };
1624916249 pdesc.ids = &type;
@@ -20669,6 +20669,8 @@ ecs_type_t flecs_prefab_spawner_build_type(
2066920669 ecs_type_t dst = {0};
2067020670 ecs_type_t *src = &table->type;
2067120671
20672+ flecs_type_add(world, &dst, ecs_id(EcsParent));
20673+
2067220674 int32_t i, count = src->count;
2067320675 for (i = 0; i < count; i ++) {
2067420676 ecs_id_t id = src->array[i];
@@ -20909,6 +20911,7 @@ void flecs_spawner_instantiate(
2090920911 ecs_assert(cr != NULL, ECS_INTERNAL_ERROR, NULL);
2091020912
2091120913 int32_t parent_column = table->component_map[ecs_id(EcsParent)];
20914+ ecs_assert(parent_column != 0, ECS_INTERNAL_ERROR, NULL);
2091220915 EcsParent *parent_ptr = table->data.columns[parent_column - 1].data;
2091320916 parent_ptr = &parent_ptr[row];
2091420917 parent_ptr->value = parent;
@@ -41161,6 +41164,8 @@ void flecs_bootstrap_parent_component(
4116141164 .ctor = flecs_default_ctor,
4116241165 .on_replace = flecs_on_replace_parent
4116341166 });
41167+
41168+ ecs_add_pair(world, ecs_id(EcsParent), EcsOnInstantiate, EcsDontInherit);
4116441169}
4116541170
4116641171
0 commit comments