Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
phaser 3 throws "Texture.frame missing:" warning and fails to load frame, how do I fix it?

Note: my code is already running and rendering the sprite

just one click to play with


I'm learning a phaser3 loader example

here is the code I wrote

class BootScene extends Phaser.Scene {
  constructor() {
    super();
  }
  preload() {
    this.load.path = 'https://raw.githubusercontent.com/liyi93319/phaser3_rpg/main/part1/assets/';
    this.load.atlas('player', 'knight_atlas.png', 'knight_atlas.json');
  }
  create() {
    var player = this.add.sprite(80, 100, 'player', 0);
    player.setScale(.5);
  }
}

var config = {
  width: 400,
  height: 300,
  pixelArt: true,
  physics: {
    default: 'arcade',
    arcade: {
      gravity: { y: 0 },
    }
  },
  backgroundColor: 0x000000,
  scene: [BootScene]
}

var game = new Phaser.Game(config);
<script src="https://cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>

Everything works fine so far.

However, changing the create() as follows

  create() {
    var player = this.add.sprite(80, 100, 'player', 5);
    player.setScale(.5);
  }

doesn't load the frame as expected and throws a warning

Texture.frame missing: 5

I compared the 'knight_atlas.json' file with the one from the official example. I don't see the difference.

I also checked the doc but didn't find a solution.

What am I missing?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to use the third parameter you would have to use the string (or Texture Object), in this case the filename from the atlas should work. Here the is relevant documentation

class BootScene extends Phaser.Scene {
  constructor() {
    super();
  }
  preload() {
    this.load.path = 'https://raw.githubusercontent.com/liyi93319/phaser3_rpg/main/part1/assets/';
    this.load.atlas('player', 'knight_atlas.png', 'knight_atlas.json');
  }
  create() {
    var player = this.add.sprite(80, 100, 'player', 'Attack (3).png');
    player.setScale(.5);
    
    var player2 = this.add.sprite(240, 100, 'player', 'Idle10');
    player2.setScale(.5);
  }
}

var config = {
  width: 400,
  height: 300,
  pixelArt: true,
  physics: {
    default: 'arcade',
    arcade: {
      gravity: { y: 0 },
    }
  },
  backgroundColor: 0x000000,
  scene: [BootScene]
}

var game = new Phaser.Game(config);
<script src="https://cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!