amethyst / editor-core

Crate that allows an Amethyst game to communicate with an editor.
Other
44 stars 10 forks source link

trait bound not satisfied #39

Closed linonetwo closed 5 years ago

linonetwo commented 6 years ago

I'm trying this tool:

// devtool setup
    let components = type_set![];
    let resources = type_set![];
    let editor_bundle = SyncEditorBundle::new()
        .sync_default_types()
        .sync_components(&components)
        .sync_resources(&resources);

let game_data = GameDataBuilder::default()
        .with(PrefabLoaderSystem::<MyPrefabData>::default(), "", &[])
        .with_bundle(AnimationBundle::<AnimationId, Transform>::new(
            "head_animation_control_system",
            "head_sampler_interpolation_system",
        ))?.with_bundle(TransformBundle::new().with_dep(&["head_sampler_interpolation_system"]))?
        .with_bundle(FPSCounterBundle::default())?
        .with_bundle(InputBundle::<String, String>::new())?
        .with_bundle(UiBundle::<String, String>::new())?
        .with(Processor::<Source>::new(), "source_processor", &[])
        .with(UiEventHandlerSystem::new(), "ui_event_handler", &[])
        .with_basic_renderer(display_config_path, DrawShaded::<PosNormTex>::new(), true)?

        // here from example ↓
        .with_bundle(editor_bundle)?;
    let mut game = Application::new(resources, EnterScene::default(), game_data)?;
    game.run();
    Ok(())

But got:

error[E0277]: the trait bound `amethyst_editor_sync::SyncEditorBundle<impl amethyst_editor_sync::ReadComponentSet, impl amethyst_editor_sync::ReadComponentSet+amethyst_editor_sync::WriteComponentSet, impl amethyst_editor_sync::ReadResourceSet, impl amethyst_editor_sync::ReadResourceSet+amethyst_editor_sync::WriteResourceSet>: amethyst::amethyst_core::SystemBundle<'_, '_>` is not satisfied
   --> src/main.rs:216:10
    |
216 |         .with_bundle(editor_bundle)?;
    |          ^^^^^^^^^^^ the trait `amethyst::amethyst_core::SystemBundle<'_, '_>` is not implemented for `amethyst_editor_sync::SyncEditorBundle<impl amethyst_editor_sync::ReadComponentSet, impl amethyst_editor_sync::ReadComponentSet+amethyst_editor_sync::WriteComponentSet, impl amethyst_editor_sync::ReadResourceSet, impl amethyst_editor_sync::ReadResourceSet+amethyst_editor_sync::WriteResourceSet>`

error[E0277]: the trait bound `amethyst_editor_sync::TypeSet<()>: std::convert::AsRef<std::path::Path>` is not satisfied
   --> src/main.rs:217:20
    |
217 |     let mut game = Application::new(resources, EnterScene::default(), game_data)?;
    |                    ^^^^^^^^^^^^^^^^ the trait `std::convert::AsRef<std::path::Path>` is not implemented for `amethyst_editor_sync::TypeSet<()>`
    |
    = note: required by `<amethyst::CoreApplication<'a, T, E, R>>::new`

error: aborting due to 2 previous errors

I'm in rustc 1.30.1 (1433507eb 2018-11-07), amethyst = "0.9.0" and amethyst-editor-sync = "0.3.0"

randomPoison commented 6 years ago

Huh, that's an odd one. Could be a version mismatch with amethyst: amethyst-editor-sync depends on amethyst 0.8, you're using amethyst 0.9. Could you try adding a patch section to your Cargo.toml to force amethyst 0.9 in all dependencies:

[patch.crates-io]
amethyst = { git = "https://github.com/amethyst/amethyst", tag = "v0.9.0" }

Let me know if that works. I'll try to get an updated version of amethyst-editor-sync that supports amethyst 0.9 out soon(-ish)!

linonetwo commented 6 years ago

like this?

[dependencies]
amethyst = "0.9.0"
log = "0.4.6"
serde = "1.0.80"
amethyst-editor-sync = "0.3.0"

[patch.crates-io]
amethyst = { git = "https://github.com/amethyst/amethyst", tag = "v0.9.0" }

Same error actually...

randomPoison commented 5 years ago

Hey, sorry for the slow response! I finally had a chance to look into this some more and I haven't been able to reproduce it consistently. I briefly ran into something that looked similar, but it went away after running cargo clean. Would you be able to provide me with the code that's causing the problem? I can try to look into it more if I'm able to see exactly what's going on.

linonetwo commented 5 years ago

@randomPoison Sure, look at this branch https://github.com/linonetwo/CS275-Assignment/tree/refactor/use-amethyst

caitp commented 5 years ago

This is due to the version mismatch, as had been mentioned.

The tip of the master branch uses Amethyst 0.9, so you can work around this with the following

[dependencies]
amethyst-editor-sync = { git = "https://github.com/randomPoison/amethyst-editor-sync/" }

That said, is there anything blocking a release to sync with the version of amethyst commonly in use?

randomPoison commented 5 years ago

No real blocker aside from my own lack of free time 😓 I'm going to be freeing up some time for myself to dedicate to this in the next couple of weeks, at which point I'll be able to publish an updated version pinned to Amethyst 0.10. Sorry for all the delays!

randomPoison commented 5 years ago

Sorry for all the delays! I have finally updated amethyst-editor-sync to work with Amethyst 0.10, and will be publishing the changes as version 0.4 soon! @linonetwo if you've updated your project to use Amethyst 0.10, please give the latest code on the master branch a try and let me know if it resolves your issue 🙂

randomPoison commented 5 years ago

I'm going to close this down since I the underlying issue should be resolved for the latest version of Amethyst. Please feel free to re-open if you run into the same issue after updating amethyst and amethyst-editor-sync 🙂