Skip to content

When calling Entity.Delete(), the entity passed to EntitySystem.OnRemoved does not contain any components. #99

Description

@raycrasher

Sample code:

entity.AddComponent(new TestHealthComponent());
world.Update();
entity.Delete();

// in system, using Aspect.All(typeof(TestHealthComponent))

public override void OnRemoved(Entity entity) 
{
    Debug.Assert(entity.GetComponent<TestHealthComponent>()!=null);  <- fails
}

The components should be accessible during the call to OnRemoved, so that the system can have a chance to clean up.

I think this is related to Issue #49.

In EntityWorld.Update, the following code is called:

                    this.TagManager.Unregister(entity);
                    this.GroupManager.Remove(entity);
                    this.EntityManager.Remove(entity);

before this

this.EntityManager.Refresh(entity);

Thus, OnRemove is called with an empty Entity.

I have tried coming up with a solution, but my knowledge of Artemis' internals is still too limited.

Thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions