rust - 紫晶 rust : 'Cannot insert multiple systems with the same name ("parent_hierarchy_system") when running pong tutorial

标签 rust amethyst

我正在学习 Rust 的 Amethyst 框架。现在我遵循乒乓球教程here 。 在第 3 步(移动桨)教程中,教授如何设置用于移动桨的系统。 我遵循了所有步骤,但是当我 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初始化的代码。

最佳答案

您已添加 TransformBundle 两次。

删除一个即可消除此错误。

关于rust - 紫晶 rust : 'Cannot insert multiple systems with the same name ("parent_hierarchy_system") when running pong tutorial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59008310/

相关文章:

rust - rustdoc 是否生成可运行的二进制文件?

generics - 如何避免传递类型依赖?

Rust Amethyst Pong 教程示例给出 "error: no example target named ` pong_tutorial_0 1`"

rust 和紫 Crystal - 错误 [E0433] : failed to resolve: could not find `__rt` in `quote`

r - R 中有类似 Rust 模式语法的东西吗?

rust - 借用GameMaster(自己)到GameState

rust - "associated types may not be referenced here"

linux - Rust `std::time::Instant` "panicked at ' 提供的瞬间晚于 self “

rust - 如何使用Rust和Amethyst运行可执行文件