friflo / Friflo.Engine.ECS

C# ECS 🔥 high-performance
https://friflo.gitbook.io/friflo.engine.ecs
GNU Lesser General Public License v3.0
158 stars 11 forks source link

After deleting the entity, the target entity still has incoming links. #13

Closed Belzebbuz closed 3 weeks ago

Belzebbuz commented 2 months ago

This test fail

var store = new EntityStore();
var entityA = store.CreateEntity();
var entityB = store.CreateEntity();
entityA.AddRelation(new Link(entityB));

entityA.DeleteEntity();

var incomingLinks = entityB.GetIncomingLinks<Link>();
incomingLinks.Count.Should().Be(0);

private readonly struct Link(Entity target) : ILinkRelation
{
    public Entity GetRelationKey() => target;
}

image

friflo commented 4 weeks ago

add test Test_Relations_GitHub_13 to reproduce bug.

friflo commented 3 weeks ago

Fixed by Fix: Remove incoming links if removing linked target entity

friflo commented 6 days ago

Fixed in 3.0.0-preview.14