- Home /
ECS find entity position component
I want to pluck the Position
data from an Entity
without keeping a reference to it.
Can this be done?
When an Entity is created via EntityManager.CreateEntity()
an Index
is assigned but that index is shuffled around and "invalidated".
What I mean is I created 2001 Entities. "Entity 2000" has index 2000 but EntityManager.GetAllEntities()[2000]
does not return the entity with Index == 2000
. Unity shuffles the ordering of entities internally so the Entity with Index == 2000
is actually sitting in GetAllEntities()[1800]
.
Is there any way to get the correct index without keeping a reference to the entity?
Comment