belly icon indicating copy to clipboard operation
belly copied to clipboard

can you pass Resources to run!()?

Open PhaestusFox opened this issue 1 year ago • 2 comments

I want to have buttons that when clicked change the state of my game, is it possible to pass the NextState resource in so that I can change it when the button is pressed? I saw you can go the other way with the from!() and update a component from a resource but saw no way to update a resource from a component

<for tab in = Tab::iter()>
  <button c:tab with=tab on:press=run!(|tab: &Tab, next: mut ResMut<NextState>| next.set(*tab))>
    <img c:icon src=tab.icon()/>
  </button>
</for>

PhaestusFox avatar Apr 23 '23 05:04 PhaestusFox