Closed cy920820 closed 2 months ago
The issue might be related to WebGL context loss and restoration. Phaser 3.80 introduced features to handle WebGL context loss. Ensure you are listening for the LOSE_WEBGL
and RESTORE_WEBGL
events in your game. Refer to the WebGL Context Restore documentation for implementation details. Example:
this.game.renderer.on('LOST', () => {
console.warn('WebGL context lost');
});
this.game.renderer.on('RESTORED', () => {
console.log('WebGL context restored');
});
/changelog/3.80/CHANGELOG-v3.80.md /changelog/3.80/WebGLContextRestore.md
Why can it run normally the first time, but not the second time
There's nothing we can do with this level of information I'm afraid. The issue is not Phaser inside a Webview. Lots of users wrap it in that way. So it has to be something specific about the game code, or the wrapper code. Confirm this for yourself by creating a base Phaser test that has nothing but a single image in it. Does that also fail to run a second time? If so, check how the view is being re-run. There are various events within Phaser you can listen for, especially as part of the boot process, to know at which stage it's failing. Debugging is going to be the key here.
Version
Description
Embedding Phaser3 into the Android webview, the game runs normally when opened for the first time, but does not run when opened for the second time
When I was debugging with Chrome, I clicked on manually refreshing the webview page for the game to run normally, and there were no error messages on the console
Example Test Code
Additional Information