Unable to use bundles in BSN

Open
#26,401 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
20/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
game-dev

Research direction

The failure is the SceneEffect trait bound that bsn! requires when a Bundle appears inside a scene, and the linked SceneComponent docs are the workaround the reporter found. Start by reading how bevy_scene decides which types may appear in bsn!, and check whether a bundle-to-scene conversion already exists. Done means a maintainer has chosen between documenting the workaround, improving the error message, or supporting bundles directly, and the chosen path is reflected in code or docs.

Written by the indexing model from the issue text.

Description

A-Scenes C-Bug D-Complex S-Needs-Design

Bevy version and features

0.20.1

What you did

#[derive(Component, Clone, Default)]
struct A;
#[derive(Component, Clone, Default)]
struct B;

#[derive(Bundle, Clone, Default)]
struct Bundle {
    a: A,
    b: B,
}

fn scene() -> impl Scene {
    bsn! {
        Bundle {
            a: A,
            b: B
        }
    }
}

What went wrong

the trait bound `Bundle: SceneEffect` is not satisfied

Additional information

It appears that SceneComponent is what you are supposed to use for "nameable" sub-pieces of a scene. However, this requires writing an extra function that will just copy the contents of the bundle to the scene. If this is the correct behavior, it should be documented (and ideally give a better error message) for users like me who try to use bundles in scenes and get confused. Otherwise, I might suggest that there is an intuitively obvious behavior here, namely, the above should be equivalent to

fn scene() -> impl Scene {
    bsn! {
        A
        B
    }
}
Dominant language
Rust
Stars
49.8k
Forks
5.1k
Avg merge
3d 4h
Merged PRs (30d)
136

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bevyengine/bevy

All issues in bevyengine/bevy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.