Unable to use bundles in BSN

Đang mở
#26,401 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
20/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
game-dev

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
    }
}
Ngôn ngữ chính
Rust
Star
49.7k
Fork
5k
Merge trung bình
3 ngày 19 giờ
Pull request đã merge (30 ngày)
134

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bevyengine/bevy

Tất cả issue của bevyengine/bevy

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.