Unable to use bundles in BSN

オープン
#26,401 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
game-dev

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
    }
}
主要言語
Rust
スター
49.7k
フォーク
5k
平均マージ
3日 19時間
マージ済み PR(30日)
134

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bevyengine/bevy のほかの issue

bevyengine/bevy の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。