How to get Archetype of an Entity?

How can I obtain the Archetype from an existing entity? It seems like it should be possible, but can not find out how.

Back story:

I am following the example here: Runtime entity creation | Hybrid Renderer | 0.11.0-preview.44 to properly render a “pure ecs” entity.

The example uses a disposable prototype entity, and instantiates clones in a parallel loop.

However, I think it would be better to obtain the Archetype, then all clones could be allocated at once via entityManager.CreateEntity(archetype,count) …

i’m also still trying to figure out how to copy the component data in bulk though.

Can you not just use prefab entity, to instantiate entities in similar manner as CreateEntities?

1 Like

The archetype is stored on the chunk.

EntityManager.GetChunk(YourEntity).Archetype

Alternatively you can get the chunk doing chunk iteration from an EntityQuery.

3 Likes

actually yeah, I now see entityManager.Instantiate(entity, nativeArrayOut) which looks to do what I want (bulk allocation) so I will use that.

Thanks! I will try figuring out how to bulk update chunk component data next…