Skip to content

Intended way to retrieve a specific entity from an EGID? #95

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

You must be logged in to vote

as long as you have an EGID available, you can query directly an Entity. There are two ways to do this:

first one is to use (Try)QueryEntitiesAndIndices

//this pattern KILLLS performance, components must be 1:1
            var gridRotationStructs   = entitiesDB.QueryEntitiesAndIndex<GridRotationStruct>(egid, out uint index);
            var (positions, _) = entitiesDB.QueryEntities<PositionEntityStruct>(groupID);
            var (rotations, _) = entitiesDB.QueryEntities<RotationEntityStruct>(groupID);
            var (scalings, _) = entitiesDB.QueryEntities<ScalingEntityStruct>(groupID);
            var (skews, _) = entitiesDB.QueryEntities<SkewComponent>(groupID);

            ref GridRo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Danon5
Comment options

Answer selected by Danon5
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