andreakarasho / TinyEcs

A tiny bevy-like archetype-style ECS library for dotnet
MIT License
113 stars 1 forks source link

Resource access between Schedules? #34

Open marcosandresacevedo opened 3 weeks ago

marcosandresacevedo commented 3 weeks ago

Hi.

I was wondering if there is a way to access a Res<> added on one schedule from another schedule. If there is I haven't been able to figure it out. Or maybe the intended use is that only one schedule is meant to be used for the entire game?

I'm brushing up against this because I'm using TinyECS with Monogame. I kept Monogame's starting boilerplate intact and I built a schedule for the Update(GameTime gameTime) call and a schedule for Monogame's Draw(GameTime gameTime) call.

As I go building systems that update or draw things, some of the systems in the updateSchedule.Run() will have to mutate data on resources that the drawSchedule.Run() systems needs to render. This is not a problem with entities, as entities that I Query<> are the same instances on both schedules. It may be possible that Resources are accessible by Query but I missed this as well?