phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
http://phaser.io
MIT License
1.34k stars 491 forks source link

TypeError: this._data is null when using bitmaptext #593

Closed vitorregisrr closed 6 years ago

vitorregisrr commented 6 years ago

I'm justing calling a simple bitmap text on game, but i'm having the error, i have tested it on Mozila and Chrome. TypeError: this._data

The code that i'm using is game.add.bitmapText(200, 100, 'Arial', 'BitmapText', 64);

Is that a API BUG or i'm using it wrongly?

samme commented 6 years ago
console.log(game.cache.getBitmapFont('Arial'));
nazimboudeffa commented 6 years ago

Do you mean is that a function call error ? I don't get what you call an API BUG

vitorregisrr commented 6 years ago

edited

samme commented 6 years ago

game.add.bitmapText(200, 100, 'Arial', 'BitmapText', 64);

These arguments look correct, so make sure you're loading the bitmap font correctly and the font data file (.fnt or .xml) is correct.

You can check the game cache contents with

console.log(game.cache._cache.bitmapFont)
vitorregisrr commented 6 years ago

solved, ty