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

scene example: remove unnecessary reflect(FromWorld) #11938

Merged

Conversation

awwsmm
Copy link
Contributor

@awwsmm awwsmm commented Feb 18, 2024

Objective

  • #[reflect(FromWorld)] was added to ComponentB somewhere between v0.12.1 and v0.13.0, but it is unnecessary

Solution

  • remove the unnecessary FromWorld

@awwsmm
Copy link
Contributor Author

awwsmm commented Feb 18, 2024

This is the entire diff of this example between v0.12.1 and v0.13.0

diff --git a/examples/scene/scene.rs b/examples/scene/scene.rs
index 7120fd419..ef2aef66d 100644
--- a/examples/scene/scene.rs
+++ b/examples/scene/scene.rs
@@ -34,7 +34,7 @@ struct ComponentA {
 // trait comes into play. `FromWorld` gives you access to your App's current ECS `Resources`
 // when you construct your component.
 #[derive(Component, Reflect)]
-#[reflect(Component)]
+#[reflect(Component, FromWorld)]
 struct ComponentB {
     pub value: String,
     #[reflect(skip_serializing)]
@@ -118,7 +118,8 @@ fn save_scene_system(world: &mut World) {
     scene_world.spawn(ComponentA { x: 3.0, y: 4.0 });
     scene_world.insert_resource(ResourceA { score: 1 });
 
-    // With our sample world ready to go, we can now create our scene:
+    // With our sample world ready to go, we can now create our scene using DynamicScene or DynamicSceneBuilder.
+    // For simplicity, we will create our scene using DynamicScene:
     let scene = DynamicScene::from_world(&scene_world);
 
     // Scenes can be serialized like this:

@awwsmm awwsmm changed the title remove unnecessary reflect(FromWorld) scene example: remove unnecessary reflect(FromWorld) Feb 18, 2024
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-Scenes Serialized ECS data stored on the disk labels Feb 18, 2024
@james7132 james7132 added this pull request to the merge queue Feb 18, 2024
Merged via the queue into bevyengine:main with commit 961d49f Feb 18, 2024
26 checks passed
@awwsmm awwsmm deleted the examples-scene-revert-reflect-FromWorld branch February 18, 2024 12:47
msvbg pushed a commit to msvbg/bevy that referenced this pull request Feb 26, 2024
# Objective

- `#[reflect(FromWorld)]` was added to `ComponentB` somewhere between
`v0.12.1` and `v0.13.0`, but it is unnecessary

## Solution

- remove the unnecessary `FromWorld`
msvbg pushed a commit to msvbg/bevy that referenced this pull request Feb 26, 2024
# Objective

- `#[reflect(FromWorld)]` was added to `ComponentB` somewhere between
`v0.12.1` and `v0.13.0`, but it is unnecessary

## Solution

- remove the unnecessary `FromWorld`
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-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants