specs icon indicating copy to clipboard operation
specs copied to clipboard

[Question] Is it possible to group components together (to all be accessed by 1 system)

Open DaQueenJodi opened this issue 3 years ago • 2 comments

I have a lot of *_Animation components and I want them all to be accessed by my Animator system is there a way I can group them together similar to how you can group entities together with NullStorage components? I want to do something like this:

impl<'a> System<'a> for Animator {
    type SystemData = (
        WriteStorage<'a, Animation>, // this is the group of animations
        WriteStorage<'a, Sprite>,
        ReadStorage<'a, AnimationState>,
    );
}

DaQueenJodi avatar Jul 01 '22 19:07 DaQueenJodi

I think you could use something like this:

type AnimationData<'a> = (WriteStorage<'a, AnimationComponent1>, WriteStorage<AnimationComponent2>);

and then use AnimationData in your system.

torkleyy avatar Jul 10 '22 10:07 torkleyy

thanks that's exactly what I was looking for!

DaQueenJodi avatar Jul 10 '22 15:07 DaQueenJodi

closing since the question was answered

Imberflur avatar Sep 25 '23 02:09 Imberflur