Load plugin webfont

Hi everybody :slightly_smiling_face:

I try to load the “Luckiest Guy” fontfamily to my app.

I wanna use the webfont plugin here : Webfont loader - Notes of Phaser 3

BUT i have an error when i do this :

in my index.html :

window.onload = function() {
        var config = {
            type: Phaser.AUTO,
            scale: {
                mode: Phaser.Scale.FIT,
                autoCenter: Phaser.Scale.CENTER_BOTH,
                width: 800,
                height: 814//600
            },pack: {
                files: [{
                    type: 'plugin',
                    key: 'rexwebfontloaderplugin',
                    url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/    rexwebfontloaderplugin.min.js',
                    start: true
                }]
            },
            scene: [MainScene, jeu, map, wanted, leaderboard]
        };

        game= new Phaser.Game(config);

    };

    <script type="text/javascript" src="MainScene.js"></script>

and in my MainScene.js :

class MainScene extends Phaser.Scene    {

    constructor(){
        super({key: 'MainScene' });
    }
    preload () {
        this.plugins.get('rexwebfontloaderplugin').addToScene(this);

it’s display this :

what i do wrong please ?

thx !

The pack options belong in the scene config, not the game config. Put them alongside the key in MainScene's constructor.

1 Like

niiice thx !

But if i wanna charge the plugin in all the scene, i have to reload each time ? ok i’ll do that !

Thanks again !