Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SceneInstanceReady #9313

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

Shatur
Copy link
Contributor

@Shatur Shatur commented Jul 31, 2023

Objective

Closes #9115, replaces #9117.

Solution

Emit event when scene is ready.


Changelog

Added

  • SceneInstanceReady event when scene becomes ready.

@Shatur Shatur force-pushed the instance-ready-event branch from 682971d to 302ffbf Compare July 31, 2023 08:33
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Scenes Serialized ECS data stored on the disk labels Jul 31, 2023
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this solution better: one quick improvement though :)

@Shatur Shatur requested a review from alice-i-cecile July 31, 2023 18:08
@Shatur Shatur force-pushed the instance-ready-event branch from 87f6053 to 2432b59 Compare July 31, 2023 18:10
@alice-i-cecile alice-i-cecile requested a review from mockersf July 31, 2023 21:06
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Aug 11, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 14, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 14, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 14, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 14, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Aug 15, 2023
Merged via the queue into bevyengine:main with commit d60b715 Aug 15, 2023
Shatur added a commit to projectharmonia/bevy that referenced this pull request Aug 19, 2023
# Objective

Closes bevyengine#9115, replaces bevyengine#9117.

## Solution

Emit event when scene is ready.

---

## Changelog

### Added

- `SceneInstanceReady` event when scene becomes ready.
@cart cart mentioned this pull request Oct 13, 2023
43 tasks
github-merge-queue bot pushed a commit that referenced this pull request Jul 30, 2024
# Objective

The `SceneInstanceReady` event would be more ergonomic (and potentially
efficient) if it could be delivered to listeners attached to the scene
entities becoming ready rather than into a World-global queue.

This is an evolution of @Shatur's work in #9313.

## Solution

The scene spawner is changed to trigger observers on the scene entity
when it is ready rather than enqueue an event with `EventWriter`.

This addresses the two outstanding feature requests mentioned on #2218,
that i) the events should be "scoped" in some way and ii) that the
`InstanceId` should be included in the event.

## Testing

Modified the `scene_spawner::tests::event` test to use the new
mechanism.

---

## Changelog

- Changed `SceneInstanceReady` to trigger an entity observer rather than
be written to an event queue.
- Changed `SceneInstanceReady` to carry the `InstanceId` of the scene.

## Migration Guide

If you have a system which read `SceneInstanceReady` events:

> ```fn ready_system(ready_events: EventReader<'_, '_,
SceneInstanceReady>) {```

It must be rewritten as an observer:

> ```commands.observe(|trigger: Trigger<SceneInstanceReady>| {```

Or, if you were expecting the event in relation to a specific entity or
entities, as an entity observer:

> ```commands.entity(entity).observe(|trigger:
Trigger<SceneInstanceReady>| {```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Scenes Serialized ECS data stored on the disk C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit event when scene is ready
3 participants