Entity entity = World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntity(
typeof(Translation),
typeof(LocalToWorld),
typeof(RenderMesh),
typeof(Scale),
typeof(Unit)
);
2. CreateArchetype( ComponemtType tpye ,xxxx)
原型可挂载多个ComponentData,可配合NativeArray生成多个Entity
{
var entityManager=World.DefaultGameObjectInjectionWorld.EntityManager;
NativeArray<Entity> entityArray = new NativeArray<Entity>(10, Allocator.Temp);
EntityArchetype entityArchetype = entityManager.CreateArchetype(typeof(RenderMesh),
typeof(LocalToWorld),typeof(Translation), typeof(RenderBounds), typeof(Rotation));
entityManager.CreateEntity(entityArchetype,entityArray);
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)