#What's the right way to restart game?
1 messages · Page 1 of 1 (latest)
unloading scene only unloads entities created from scene (or technically, those that have SceneTag component with specific value)
you need to design restart all by yourself
at worst you can just recreate world
Hi Issue,
I've checked and the entities created by EntityManager.CreateEntity() don't have any SceneTag component.
Only Entities created by EntityManager.Instantiate() have a SceneTag component.
So we have to manually add SceneTag component to entities created by EntityManager.CreateEntity()?
Perhaps I should recreate the world to clear all the entities
no, you really shouldn't
I'd suggest to just keep track of all such entities
and manually destroy/reset them
usually CreateEntity is only used for singletons
so that's rarely a problem
As you just said we have to manually destroy/reset all entities now.
and what was before?
We only need to call SceneManager.LoadScene to restart game using old GameObject scene.
So I thought that we could just reload scene to restart game using Entity Scene
That's only true if you have one scene
and you don't use additive scenes
and still
that kind of results in you losing all GO managers
which makes you do opposite: ensure they stay alive