how do you make code that hot reloads nicely?

I change the system’s code, press save and go back to unity that’s playing the scene
everything disappears
how do you retain everything?

We don’t support this yet, however exactly this is something we’re actively working on, for both editor and player workflows.

6 Likes

Awesome!!
Any pattern you have in mind? I’d like to pre pattern my code in anticipation to this highly anticipated rollout.

All state in the ecs store will persist, all the state outside of it will not (though we will give you a callback that lets you “prepare for being reloaded”)

1 Like

what’s an ecs store? IComponentData?

Considering that it’s trivial to get a snapshot of the current ECS state, this seems pretty straight forward. The big issue is reloading such state after the code base have changed

Yes, any components on entities. If you store data in “normal” c# data structure outside of the entity world, you have to make sure you can serialize that yourself or can recreate it. Basically idiomatic ecs usage should work out of the box.

1 Like

Ok perfect so like @Guedez was saying if I change the code to IComponentData then you guys might have to discard some stuff during hot reload.