bevyengine / bevyengine/bevy-website

Document the "no method named `system` found for fn" error

Open
#82 2 comments 0 reactions 0 assignees View on GitHub
A-Book
Dominant language
JavaScript
Stars
249
Forks
450
Avg merge
16h 20m
Merged PRs (30d)
6

Description

Getting the wrong signature for a function leads to a complex error message like

```
error[E0599]: no method named `system` found for fn item `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut bevy::prelude::Commands, &'s mut bevy::prelude::ResMut<'t0, GameState>, bevy::prelude::Query<'t1, (&'t2 PieceIndex, &'t3 mut Position), bevy::prelude::With>) {place_current_piece}` in the current scope
--> src/main.rs:168:41
|
168 | .add_system(place_current_piece.system())
| ^^^^^^ method not found in `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut bevy::prelude::Commands, &'s mut bevy::prelude::ResMut<'t0, GameState>, bevy::prelude::Query<'t1, (&'t2 PieceIndex, &'t3 mut Position), bevy::prelude::With>) {place_current_piece}`
|
= note: `place_current_piece` is a function, perhaps you wish to call it
```

I managed to solve my issue thanks to [this reddit comment](https://www.reddit.com/r/bevy/comments/iq4osd/help_with_systems/) (specifically I had the arg `state: &mut ResMut` where bevy wanted `mut state: ResMut`), but that was literally the only helpful documentation I could find.

The error and a set of guidelines for what an acceptable fn signature is should be documented somewhere in the bevy book, perhaps in the `Troubleshooting` section to begin with.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.