isfuturebright Posted October 29, 2013 Share Posted October 29, 2013 After adding a new state to my game I'm getting this error:Uncaught TypeError: Cannot read property 'baseTexture' of undefined phaser.js:5454PIXI.WebGLRenderGroup.initTilingSpritephaser.js:5454PIXI.WebGLRenderGroup.insertObjectphaser.js:5250PIXI.WebGLRenderGroup.addDisplayObjectAndChildrenphaser.js:5106PIXI.WebGLRenderGroup.setRenderablephaser.js:4659PIXI.WebGLRenderer.renderphaser.js:4398Phaser.Game.updatephaser.js:10334Phaser.RequestAnimationFrame.updateRAFphaser.js:16157_onLoopIt's happened before, but I don't remember how I solved it. I think it was something like changing when I load an asset or something. Has anyone come across this? Link to comment Share on other sites More sharing options...
rich Posted October 29, 2013 Share Posted October 29, 2013 Share some code Impossible to debug otherwise. Link to comment Share on other sites More sharing options...
isfuturebright Posted October 30, 2013 Author Share Posted October 30, 2013 I realized that it happens everytime I start on the BootState. Don't know why. game.state.add('BootScreen', SoccerGame.BootScreen); game.state.add('PreloaderScreen', SoccerGame.PreloaderScreen); game.state.add('MenuScreen', SoccerGame.MenuScreen); game.state.add('GameScreen', SoccerGame.GameScreen); game.state.start('BootScreen');The BootScreen is pretty standart:SoccerGame = {}SoccerGame.BootScreen = function (game) { this.game = game;};SoccerGame.BootScreen.prototype = { preload: function () { // Here we load the assets required for our preloader (in this case a background and a loading bar) //this.load.image('preloaderBackground', 'images/preloader_background.jpg'); //this.load.image('preloaderBar', 'images/preloadr_bar.png' }, create: function () { this.game.state.start("PreloaderScreen"); }}; Link to comment Share on other sites More sharing options...
rich Posted October 30, 2013 Share Posted October 30, 2013 There's nothing wrong with the code above, so the error isn't coming from there. An error with a BaseTexture usually means you've used an image cache ID (like 'preloaderBar') that doesn't exist. Maybe with a typo in it, or maybe the file didn't load successfully. Link to comment Share on other sites More sharing options...
isfuturebright Posted October 30, 2013 Author Share Posted October 30, 2013 (edited) As I was debugging he shows this error on the MenuScreen which is called from the PreloaderScreen. So could it be that the MenuScreen is trying to use something that hasn't been loaded? The weird thing is that if I start from the PreloaderScreen everything works just fine. I only get this error when going through the BootScreen before the Preloader. I managed to fix it but it was a weird solution... Only thing I did was add the load.image on BootScreen instead then load it on preloader screen. Makes no sense since this image is only used on the MenuScreen. Edited October 30, 2013 by isfuturebright Link to comment Share on other sites More sharing options...
isfuturebright Posted October 30, 2013 Author Share Posted October 30, 2013 The weird thing happening now is that he's calling the 'create' on the MenuScreen twice. This is the console log: [bOOTSCREEN] (): preload Util.js:31Phaser 1.0.4 initialized. Rendering to WebGL phaser.js:10262[bOOTSCREEN] (): create Util.js:31[PRELOADERSCREEN] (): preload Util.js:31[PRELOADERSCREEN] (): create Util.js:31[MENUSCREEN] (): Preload Util.js:31[MENUSCREEN] (): create Util.js:31[MENUSCREEN] (): create Util.js:31 Link to comment Share on other sites More sharing options...
isfuturebright Posted October 30, 2013 Author Share Posted October 30, 2013 Nevermind me @rich. I had the new version of Phaser but didn't update the copy on my project folder. All working as it should now. Can close this Link to comment Share on other sites More sharing options...
rich Posted October 30, 2013 Share Posted October 30, 2013 Heh I was going to say, 1.0.4 is a bit old now Link to comment Share on other sites More sharing options...
Recommended Posts