Phaser: there is no texture bound to the unit 1

Created on 23 Dec 2020  路  7Comments  路  Source: photonstorm/phaser

Version

  • Phaser Version: 3.50.0
  • Operating system: Mac Pro
  • Browser: 5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36

Description

Add tileSprite in the create function: this.add.tileSprite(0, 0, 200, 500,'ball1'), and then call this.scene.restart(), I received many of the same errors.

Xnip2020-12-23_14-04-27

Example Test Code

create: function ()
    {
        this.add.tileSprite(0, 0, 200, 500, 'ball1')
        this.matter.world.setBounds(0, 0, 800, 600, 32, true, true, false, true);

        for (var i = 0; i < 64; i++)
        {
            var ball = this.matter.add.image(Phaser.Math.Between(100, 700), Phaser.Math.Between(-600, 0), 'ball1');
            ball.setCircle();
            ball.setFriction(0.005);
            ball.setBounce(1);
        }

        this.input.once('pointerdown', function (event) {

            this.scene.restart();

        }, this);
    }

Additional Information

馃悰 Browser Bug 馃敭 Renderer (WebGL)

Most helpful comment

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

All 7 comments

I am having the same problem. Weirdly it is not happening on latest chrome desktop browser but instead on my latest android chrome browser.

So for me it only happens on mobile browsers but not on desktop.

Test: https://codepen.io/samme/pen/zYKPGbe

I don't see an error in my Safari.

Cannot say about safari but still happens on latest chrome android browser.

Capture

I'm not sure if this is an identical issue, but on latest Chrome, with Phaser 3.50.1, I get errors like [.WebGL-0x7fdee9d4e600]RENDER WARNING: there is no texture bound to the unit 9 when I have code like:

const text = scene.add.text(0, 0, "hello")
// ...
text.destroy()

I can suppress the warning by setting the text object's texture to the WebGL blank texture before destroying the text object, e.g.

const text = scene.add.text(0, 0, "hello")
// ...
text.texture = scene.renderer.blankTexture // Should be wrapped in conditional when rendering direct to canvas?
text.destroy()

Phaser Version: 3.50.0
Operating system: Mac Pro
Browser: Chrome Version 87.0.4280.88 (Official Build) (x86_64)

bugfix

I encountered this problem using this code When you click the bear image in https://labs.phaser.io/edit.html !

class PreloadScene extends Phaser.Scene {
    constructor() {
        super({ key: 'PreloadScene' });
    }
    preload() {
        this.load.image('bunny', 'assets/sprites/bunny.png');
    }
    create() {
        console.log('PreloadScene')
        this.scene.start('GameMenuScene');
    }
}

class GameMenuScene extends Phaser.Scene {
    constructor() {
        super({ key: 'GameMenuScene' });
    }
    create() {
        console.log('GameMenuScene')
        var bunny = this.add.sprite(48, 102, 'bunny');
        bunny.setOrigin(0, 0);
        bunny.setDisplaySize(72, 72);
        // bunny.alpha = 0.5;
        bunny.setInteractive().on('pointerdown', () => {
            this.scene.start('GameScene');
        }, this);
        this.add.text(200, 100, 'Case shrugged.\nThe girl to his right giggled and nudged him.', { color: '#00ff00', align: 'left' });
    }
}

class GameScene extends Phaser.Scene {
    constructor() {
        super({ key: 'GameScene' });
    }
    create() {
        console.log('GameScene')
        var bunny = this.add.sprite(48, 102, 'bunny');
        bunny.setOrigin(0, 0);
        bunny.setDisplaySize(72, 72);
        // bunny.alpha = 0.5;
    }
}

var config = {
    type: Phaser.WEBGL,
    parent: 'phaser-example',
    width: 800,
    height: 600,
    scene: [PreloadScene, GameMenuScene, GameScene]
};
var game = new Phaser.Game(config);

Facing the same issue.

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hugoruscitti picture hugoruscitti  路  3Comments

SKEPDIMI picture SKEPDIMI  路  4Comments

lilijreey picture lilijreey  路  4Comments

Legomite picture Legomite  路  4Comments

MarkSky picture MarkSky  路  3Comments