I am trying this code from Phaser 3 examples…
class Example extends Phaser.Scene
{
constructor ()
{
super();
}
preload ()
{
this.load.bitmapFont('desyrel', 'https://labs.phaser.io/assets/fonts/bitmap/desyrel.png', 'https://labs.phaser.io/assets/fonts/bitmap/desyrel.xml');
}
create ()
{
this.dynamic1 = this.add.bitmapText(0, 0, 'desyrel', 'hello world', 60);
}
update ()
{
this.dynamic1.text = 'Value: boo';
}
}
const config = {
type: Phaser.CANVAS,
parent: 'phaser-example',
scene: [ Example ]
};
const game = new Phaser.Game(config);
It works fine but if I try to load the font from my own path with:
this.load.bitmapFont('desyrel', 'fonts/desyrel.png', 'fonts/desyrel.xml');
I get the following error:
Invalid BitmapText key: desyrel
Uncaught TypeError: Cannot read property ‘data’ of undefined
What can be causing it?