Jump to content

Uncaught TypeError: Uncaught TypeError: Cannot read property 'baseTexture' of undefined


Recommended Posts

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_onLoop

It'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

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

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 by isfuturebright
Link to comment
Share on other sites

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:31
Phaser 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...