Skip to content

Use boxed systems or observers to instantiate new site elements #416

@mxgrey

Description

@mxgrey

Currently new site elements get instantiated using systems in the schedule that use an Added<T> filter. At the same time there are scheduled systems that update site elements when various things in the environment change, such as the current level or properties of other objects which may effect each other.

We persistently run into cases where these instantiation systems run into race conditions against the update systems. There isn't a clear way to resolve these races while keeping both in the schedule.

I think the most straightforward solution would be to have a set of boxed systems for each element type which instantiate that element at load time. We would no longer have systems that track Added<T> in the schedule, instead we would run their instantiation system during loading or creation.

Alternatively we could introduce observers that track when a new instance of the relevant element gets added. This should have a similar effect and may fit better into the latest bevy idioms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions