amethyst / specs

Specs - Parallel ECS

Home Page:https://amethyst.github.io/specs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to make creating new entity in system easier?

NathanYukai opened this issue · comments

Description

Use EntityResBuilder to build entities need to pass the storages in as parameter, which is not ideal if the entity need lots of component.

Motivation

What I'm trying to achieve is a nice way of creating new entity during a tick
I tried work around this by write the new entity requests into a 'Builder', fetch it and then create the entity using EntityBuilder.
But that seems impossible because that means I need to borrow World as mutable and as immutable at the same time.

Am I missing something? I'm a beginner so maybe my workaround is possible but I just didn't managed to fight the borrow checker correctly.

commented

You can use LazyUpdate which defers the creation of entities to end of the tick.

Thanks ! that's what I need!