【问题标题】:Amethyst Rust: 'Cannot insert multiple systems with the same name ("parent_hierarchy_system") when running pong tutorialAmethyst Rust:'在运行 pong 教程时无法插入多个同名系统(“parent_hierarchy_system”)
【发布时间】:2020-04-23 06:25:28
【问题描述】:

我正在学习 Rust 的 Amethyst 框架。现在我按照乒乓教程here。 在第 3 步(移动桨)教程中,教授如何设置 System 用于移动桨。 我遵循了所有步骤,但是当我 cargo run 我的应用程序时出现错误:

thread 'main' panicked at 'Cannot insert multiple systems with the same name ("parent_hierarchy_system")', /home/path_to_cargo/shred-0.9.4/src/dispatch/builder.rs:172:17

我只是尝试从教程的 GitHub 存储库中复制,但得到了相同的结果。

我的Cargo.toml 看起来:

[package]
name = "pong"
version = "0.1.0"
authors = []
edition = "2018"

[dependencies.amethyst]
version = "0.13"
features = ["vulkan"]

我在 Ubuntu 19.10 上运行该项目。 Rust 1.37 版。

我的猜测是 input_system 在运行时以某种方式添加了两次。我已经在两个教程存储库中搜索了相同的问题和网络。但似乎我是唯一一个面对它的人。也许解决方案很简单,但我花了周六的时间试图解决它。

let game_data = GameDataBuilder::default()
    .with_bundle(TransformBundle::new())?
    .with_bundle(input_bundle)?
    .with(systems::PaddleSystem, "paddle_system", &["input_system"]) // Add this line
    .with_bundle(
        RenderingBundle::<DefaultBackend>::new()
            .with_plugin(
                RenderToWindow::from_config_path(display_config_path)
                    .with_clear([0.0, 0.0, 0.0, 1.0]),
            )
            // RenderFlat2D plugin is used to render entities with a `SpriteRender` component.
            .with_plugin(RenderFlat2D::default()),
        )?
    .with_bundle(TransformBundle::new())?;

我的GameDataBuilder初始化代码。

【问题讨论】:

  • 你能试试RUST_BACKTRACE=1 cargo run吗?它会告诉你恐慌的起源,这也可能是违规行。
  • @edwardw 错误发生在我初始化game_data 然后初始化应用程序本身let mut game = Application::new(assets_dir, Pong, game_data)?;

标签: rust amethyst


【解决方案1】:

您已经添加了两次TransformBundle

删除一个将删除此错误。

【讨论】:

    猜你喜欢
    • 2021-05-28
    • 2021-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多