Easy Way To "reload" Active World?

Previously I would often reload the current scene to restart whatever happens in that scene, is there any way to do something similar for the active world? I can do

World.Active.Dispose();

but I havent found a way to reload the world as it happens on startup?

There is a DisposeAllWorlds method, but worlds are designed to have a game scope so I don’t think I would do that even if you can.

What I do is the systems that need it implement an interface with OnActivate(Scope scope)/OnDeactivate(Scope scope) methods. I use that to manage state of various scopes which could be a scene unload/load or something else.

You could also tag entities with a scope component of some type to go along with that, run a job to destroy all entities of the scope in question.

1 Like

Generally you do that by unloading the scene and all entities that are in the world that were created from code.

Systems should not carry state, so the concept of destroying a whole world to reset it doesn’t make sense.

1 Like