public IEntity CreateEntity(Action <IEntity> configure = null) { var entity = entityFactory.Create(); entityCache.AddAlive(entity); entityAttributes[entity.Id.Index] = new EntityAttributes(); entityComponents[entity.Id.Index] = new EntityComponents(); configure?.Invoke(entity); foreach (IComponent component in entityComponents[entity.Id.Index].Components.Values) { component.Setup(); } return(entity); }