Skip to content

Commit 435fab5

Browse files
committed
Merge pull request phaserjs#990 from lucbloom/warn-texture-not-found
Warn about missing textures and show the key that the author was trying to use.
2 parents 0d0a16e + 3f5bde8 commit 435fab5

3 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/gameobjects/Image.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
262262
}
263263
else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
264264
{
265+
console.warn("Texture with key '" + key + "' not found.");
265266
this.key = '__missing';
266267
this.setTexture(PIXI.TextureCache[this.key]);
267268
}

src/gameobjects/Sprite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
386386
}
387387
else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
388388
{
389+
console.warn("Texture with key '" + key + "' not found.");
389390
this.key = '__missing';
390391
this.setTexture(PIXI.TextureCache[this.key]);
391392
}

src/gameobjects/TileSprite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
358358
}
359359
else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
360360
{
361+
console.warn("Texture with key '" + key + "' not found.");
361362
this.key = '__missing';
362363
this.setTexture(PIXI.TextureCache[this.key]);
363364
}

0 commit comments

Comments
 (0)