DEV Community

Yiren Labs
Yiren Labs

Posted on Originally published at atlas-errors.petersoncool.workers.dev

Phaser 3: frame not found in texture

What you see

The animation starts, but the Console prints Frame "walk_3" not found in texture "hero". The sprite jumps through a subset of frames, freezes on the last usable frame, or shows the green missing-texture box for the missing entries. The warning repeats once per skipped frame, so an eight-frame walk cycle can render only five frames while the rest are dropped silently.

Why it happens

this.anims.create builds its frame list from generateFrameNames or generateFrameNumbers, then hands each candidate to Texture.has(frame). A candidate that misses is skipped with this warning rather than throwing, so the resulting animation holds fewer frames than the config requests. The miss usually comes from one of three mismatches: the start/end range runs past the real frame count, the prefix or suffix does not match the keys written by the atlas exporter, or a hash atlas is fed to generateFrameNumbers (which expects integer indices) while a plain spritesheet is fed to generateFrameNames. A rename in the exporter changes every frame key at once, so animation configs that matched yesterday can miss today after a re-export.

Confirm it

Log the keys the texture actually holds right after the texture loads:

this.textures.get('hero').getFrameNames().forEach(function (name) {
  console.log(name);
});
Enter fullscreen mode Exit fullscreen mode

In the Console, a healthy hash atlas prints names such as walk_1, walk_2, up to the real last frame; a plain spritesheet prints numeric strings like 0, 1, 2. If the list ends before your end value, the range is too high. If none of the printed names carry your prefix or suffix, the naming convention is wrong. Compare this list against the names your anims.create config generates.

Fix it

Rebuild the animation config against the real keys, and pick the helper that matches the asset type:

this.anims.create({
  key: 'walk',
  frames: this.anims.generateFrameNames('hero', {
    prefix: 'walk_',
    start: 1,
    end: 8,
    zeroPad: 2
  }),
  frameRate: 12,
  repeat: -1
});
Enter fullscreen mode Exit fullscreen mode

For a non-atlas spritesheet, use generateFrameNumbers('sheet', { start: 0, end: 7 }) instead. After the change, verify in code rather than by watching the canvas: log this.textures.get('hero').frameTotal and this.textures.get('hero').has('walk_03'), and confirm every key in your generated list returns true before the animation plays.

The exact engine message, with its source location, is documented here: https://atlas-errors.petersoncool.workers.dev/error/phaser-frame-not-found-in-texture/

Options

If you would rather not audit every animation range by hand, the same frame-name check can be run across a whole folder offline: the full version is $19 and there is a free sample on the fixer page.

Batch frame-name check across folders: https://atlas-errors.petersoncool.workers.dev/fixer/

Companion reference page for this engine message: https://atlas-errors.petersoncool.workers.dev/error/phaser-frame-not-found-in-texture/

Top comments (0)