Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread local systems do not compile #514

Closed
Bauxitedev opened this issue Sep 19, 2020 · 2 comments
Closed

Thread local systems do not compile #514

Bauxitedev opened this issue Sep 19, 2020 · 2 comments
Labels
A-ECS Entities, components, systems, and events

Comments

@Bauxitedev
Copy link

Bauxitedev commented Sep 19, 2020

According to the docs, you can make a thread-local system that has access to the World and Resources like this:

fn system(world: &mut World, resources: &mut Resources) {
    // do something
}

So I made a little test program...

use bevy::prelude::*;

fn main()
{
        App::build()
            .add_system(system.system())
            .run();
}

fn system(world: &mut World, resources: &mut Resources) {
    // do something
}

Unfortunately this does not seem to compile for me. I get this error:

error[E0599]: no method named `system` found for fn item `for<'r, 's> fn(&'r mut bevy::prelude::World, &'s mut bevy::prelude::Resources) {system}` in the current scope
  --> src/main.rs:22:32
   |
22 |             .add_system(system.system())
   |                                ^^^^^^ method not found in `for<'r, 's> fn(&'r mut bevy::prelude::World, &'s mut bevy::prelude::Resources) {system}`
   |
   = note: `system` is a function, perhaps you wish to call it

I'm using rustc v1.46.0.

@Moxinilian
Copy link
Member

I believe the interface to register a thread local system is not .system but .thread_local_system. Please tell us if that does the trick!

@Moxinilian Moxinilian added the A-ECS Entities, components, systems, and events label Sep 19, 2020
@Bauxitedev
Copy link
Author

@Moxinilian That worked, thanks! I guess this is something that should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events
Projects
None yet
Development

No branches or pull requests

2 participants