# Help with error after \`launch\`ing a scene that has been \`stop\`ped

**URL:** <https://phaser.discourse.group/t/help-with-error-after-launch-ing-a-scene-that-has-been-stop-ped/473>\
**Category:** Phaser 3\
**Created:** [December 26, 2018, 2:49am UTC](https://phaser.discourse.group/t/help-with-error-after-launch-ing-a-scene-that-has-been-stop-ped/473 "2018-12-26T02:49:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [December 26, 2018, 2:49am UTC](https://phaser.discourse.group/t/help-with-error-after-launch-ing-a-scene-that-has-been-stop-ped/473/1 "2018-12-26T02:49:11Z")

</div>

Hey everyone!

I’ve got a confusing problem when I restart a Scene that has previously been stopped. There’s an actual error that gets logged in the console, but the game itself doesn’t stop working per se, except for everything in the game is sped up when it shouldn’t be.

Here’s a link to a game where the issue can be reproduced - [https://snowbillr.github.io/archering/](https://snowbillr.github.io/archering/). To reproduce it, lose all 3 of your lives (click to fire the arrow and miss the target 3 times), then click the “Play Again” button on the results screen.

You’ll see in the console this error that gets logged:

 ![image](https://global.discourse-cdn.com/free1/uploads/phaser1/original/1X/0f82caaa653fde9b3ad7e1ec07e076b3505d6f76.png)

Then, shoot another arrow. You’ll see that everything has been sped up (physics and tweens in this case).

It looks like the error happens purely because of the Text object that is rendered in the `UiScene`. If you were to comment out the line in `GameScene` that launches the `UiScene`, then no error gets logged and there is no weird speed up.

If you want to try messing with it on your end, clone the github project, run `yarn install`, and then run `yarn dev` to start a server up at `localhost:8080`.

I found what appears to be a related issue here ([http://www.html5gamedevs.com/topic/37781-animations-get-faster-switching-scenes/](http://www.html5gamedevs.com/topic/37781-animations-get-faster-switching-scenes/)) but there wasn’t any real resolution to it other than doing something hacky.

Thanks for taking a look!

EDIT:

I should mention that I see the error in the latest version of Chrome on MacOS using Phaser v3.15.1-FB. I see it in both Canvas rendering mode and WebGL rendering mode.

---

<div class="post-metadata">

**Author:** ![B3L7](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/b3l7/32/25_2.png) [@B3L7](https://phaser.discourse.group/u/B3L7)\
**Post date:** [December 26, 2018, 2:02pm UTC](https://phaser.discourse.group/t/help-with-error-after-launch-ing-a-scene-that-has-been-stop-ped/473/2 "2018-12-26T14:02:56Z")

</div>

I didn’t get the error but I did experience the speed up which is strange. It looks like it is probably a bug which you may want to submit to the github issues.

Maybe instead of:

```
this.scene.stop('game');
this.scene.stop('ui');
this.scene.start('results');

```

you could do:

```
this.scene.stop('ui');
this.scene.switch('results');

```

And then having an onWake function in the game scene that resets game data and relaunches the UI?

Not sure if that would make a difference but it might be worth a try.

---

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [December 26, 2018, 2:30pm UTC](https://phaser.discourse.group/t/help-with-error-after-launch-ing-a-scene-that-has-been-stop-ped/473/3 "2018-12-26T14:30:28Z")

</div>

Thanks for taking a look at it. I managed to figure out the issue.

I put some console logging in and noticed that the error I was seeing got printed out prior to the `create` function being called in the `UiScene`. So I thought it had something to do with a registry event listener, and that ended up being right.

Turns out, I was assuming that my scene’s `destroy` method would be called when I called `stop` on the scene plugin. But that’s not the case. Which meant the code turning off the listeners for the registry events in the `UiScene` was not getting called, and they were trying to update Text objects that no longer existed. I’m not sure why this manifested in a weird speed up in the game, but it did. When I made sure that those listeners were turned off, then everything was fixed.

What I learned is that the scene doesn’t get destroyed on a `stop` call, but it does get shutdown. So I added an event handler for the `shutdown` event in my ui scene and made sure to clean up those registry listeners that updated the text objects, and that fixed it!

Thanks for the extra eyes @B3L7, much appreciated.
