Unable to use bundles in BSN

Abierto
#26,401 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
20/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
game-dev

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
    }
}
Lenguaje dominante
Rust
Estrellas
49.7k
Forks
5k
Merge medio
3 d 19 h
PR fusionados (30 d)
134

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bevyengine/bevy

Todos los issues de bevyengine/bevy

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.