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

0.11 Migration: ImageBundle and TextBundle do not implement clone anymore #699

Closed
nicopap opened this issue Jul 10, 2023 · 1 comment · Fixed by #700
Closed

0.11 Migration: ImageBundle and TextBundle do not implement clone anymore #699

nicopap opened this issue Jul 10, 2023 · 1 comment · Fixed by #700

Comments

@nicopap
Copy link
Contributor

nicopap commented Jul 10, 2023

This is a major breaking change! It's not mentioned in the migration guide as far as I can see.

Workarounds

  1. Wrap yourself the bundle type and implement Clone by skipping cloning the ContentSize field.

  2. Use a closure instead of clone

let circle = ImageBundle {
    style: image_style,
    image: materials.circle.clone(),
    ..Default::default()
};
commands.spawn(circle.clone());
commands.spawn(circle.clone());
commands.spawn(circle.clone());
commands.spawn(circle.clone());

Then becomes:

let circle = || ImageBundle {
    style: image_style,
    image: materials.circle.clone(),
    ..Default::default()
};
commands.spawn(circle());
commands.spawn(circle());
commands.spawn(circle());
commands.spawn(circle());
@nicopap nicopap changed the title 0.11 migration: ImageBundle and TextBundle do not implement clone anymore 0.11 Migration: ImageBundle and TextBundle do not implement clone anymore Jul 10, 2023
@Selene-Amanita
Copy link
Member

It comes from bevyengine/bevy#8402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants