Unable to use bundles in BSN

Aperta
#26,401 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
20/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
game-dev

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
    }
}
Lingua principale
Rust
Stelle
49.7k
Fork
5k
Merge medio
3g 19h
PR unite (30g)
134

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bevyengine/bevy

Tutte le issue di bevyengine/bevy

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.