elleniaw Posted October 4, 2016 Share Posted October 4, 2016 When I re-initialise my game for the 5th time (and weirdly always the 5th time) I get the following error in WebGL render-mode: "RENDER WARNING: there is no texture bound to the unit 0" In Canvas render mode I don't get the error and can re-initialise my game as many times as I want. With re-initialising I mean overwriting/instantiating a new phaser.Game on the same variable. To create: click on the canvas a couple of times here while having the console open: http://jsfiddle.net/cb8vhas3/ To Link to comment Share on other sites More sharing options...
tips4design Posted October 4, 2016 Share Posted October 4, 2016 Why would you create 5 different games? You don't even delete the previous ones, it's obvious that the GPU can't render so many scenes at once. You don't "re-intialize" the game, you create new games, and all of them keep running. See this, look at the console: http://jsfiddle.net/cb8vhas3/1/ (you can see that all games keep running) Link to comment Share on other sites More sharing options...
elleniaw Posted October 4, 2016 Author Share Posted October 4, 2016 Thanks for the reply. I was under the assumption that when I overwrite the reference to the game, there is no reference to the previous one and GC will pick it up. Why I want to do it this way is because I want the same game with different content coming from a server without reloading the page. How then do I delete the previous ones? and re-initialize the canvas with a new one? Link to comment Share on other sites More sharing options...
samme Posted October 4, 2016 Share Posted October 4, 2016 I think you can just call `game.destroy()`. And then repeat `new Phaser.Game(…)` as usual. Link to comment Share on other sites More sharing options...
elleniaw Posted October 5, 2016 Author Share Posted October 5, 2016 Thanks. That did the trick. Link to comment Share on other sites More sharing options...
Recommended Posts