#[Resolved;Issue was elsewhere]Integrating `Resource` with `Arc<Mutex<SomeType>>` into `.add_system()
16 messages · Page 1 of 1 (latest)
Thanks for answering! The system itself does not complain, it is the .add_systems(Update, system_with_arc_mutex) that produces a long error of "The trait bevy::prelude::IntoSystem is not implemented for ...".
What does ComponentWithArcMutex look like then?
The component in question is a Genome, containing Genes and Connections, which reference each other. I used to make it work before with RefCell, but it is !Sync, so that went out of the window right away.
So the component is
struct GenomicData {
genome: Genome,
}
And Genome is
pub struct Genome {
/// A [`Vec`] containing the [`Layer`]s which contain references to the [`NodeGene`]s.
pub layers: Vec<Layer>,
...
The Layer is
```/// A struct containing the details about a [Layer].
#[derive(Clone, Debug)]
pub struct Layer {
/// A collection of references to the [NodeGene]s that are present in the [Layer].
pub nodes: Vec<Arc<Mutex<NodeGene>>>,
...
And you're doing Query<&mut GenomicData>?
Looks like so:
mut creatures_query: Query<
(
&Transform,
&mut Decisions,
&mut GenomicData,
&Energetics,
&Health,
&Replication,
),
With<Creature>,
>,
game_assets: &Res<GameAssets>,
time: Res<Time>,
) {```
&Res should just be Res
o_o
okay, now i feel dumb.
Thank you very much!
I will remove the thread (if I can) because the title doesn't match the issue I had, but thank you from the bottom of my heart, hahaha.
😄 it happens - the easiest way I've found to debug this sort of thing is to create a new empty system and add things one at a time until it complains, but IIRC there's a macro helper to isolate those errors somewhere around here too