Skip to content

How to get the EGID of the current entity when iterating through queried entities? #108

Closed Answered by sebas77
rettoph asked this question in Q&A
Discussion options

You must be logged in to vote

the entity ID of an entity is user chosen so in theory this would work if you choose to follow that logic. However what you wrote is not guaranteed, to know the id of the entity you need to change the deconstruction of the query to:

foreach (var ((trees,  entitiesID, count), groupId) in this.entitiesDB.QueryEntities<Tree>(groups))
{
    for (uint i= 0; i< count; i++)
    {
        EGID entityId = new EGID(entitiesID[i], groupId);
    }
}

so it's engine to add an extra parameter in the deconstruction

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rettoph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
FAQ Svelto FAQs
2 participants