From f7265c213eef40b7b6e0bce5394ec0b0986af5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 11 Jun 2020 10:40:43 +0200 Subject: [PATCH] Patch --- front/src/Phaser/Game/GameManager.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index 07bb204b..c275da53 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -189,6 +189,9 @@ export class GameManager { if (this.reconnectScene === null && this.currentGameScene) { // In case we are asked to reconnect even if switchToDisconnectedScene was not triggered (can happen when a laptop goes to sleep) this.switchToDisconnectedScene(); + // Wait a bit for scene to load. Otherwise, starting ReconnectingSceneName and then starting GameScene one after the other fails for some reason. + setTimeout(() => this.reconnectToGameScene(lastPositionShared), 500); + return; } const game : Phaser.Scene = GameScene.createFromUrl(this.oldMapUrlFile, this.oldInstance); this.reconnectScene?.scene.add(this.oldSceneKey, game, true, { initPosition: lastPositionShared });