I dont understand how LinkedEntityGroup works. I create 2 entities inside SystemBase OnUpdate ForEach, then i create LinkedEntityGroup buffer:
var projectile = ecb.Instantiate(projPrefab.projectilePrefab);
var jointEntity = PhysicsUtils.CreateLockedZAxisJointEntity(projectile, ecb, drawPoints[0]);
var buffer = ecb.SetBuffer<LinkedEntityGroup>(projectile);
buffer.Add(jointEntity);
ecb - is EntityCommandBuffer
When i destroy parent entity projectile - child jointEntity not destroying. Code of destroying:
Entities
.ForEach((Entity entity, ref DeathComponent death) =>
{
death.destroyAfter -= dt;
if (death.destroyAfter <= 0f)
{
ecb.DestroyEntity(entity);
}
}).Schedule();
I check Entity Debugger, parent entity has component LinkedEntityGroup with right child.
What im doing wrong? Why child entity not destroying when i destroy parent entity?