Home / Phaser / P29

Phaser error: TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given. — cause and fix

When slicing a sub-sheet from existing atlas frames with spritesheet, the supplied frameWi

ID
P29
Engine
Phaser
Verification
源码原文(src/textures/parsers/SpriteSheetFromAtlas.js:40)
Frequency
未公开

Original message (verbatim)

TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.

Placeholders such as %s / %d are kept verbatim from the engine source and are not replaced with concrete values.

Trigger

When slicing a sub-sheet from existing atlas frames with spritesheet, the supplied frameWidth is zero, negative, or larger than the atlas frame width, and the parser throws directly.

Typical cause

SpriteSheetFromAtlas validates frameWidth before computing rows and columns; an invalid value cannot derive a valid frame width, so the constructor throws an Error and aborts texture registration.

Step-by-step fix

  1. Match frameWidth/frameHeight to the pixel size of a single frame in the atlas.
  2. Confirm the atlas frames are already registered through the atlas/json parser.
  3. Fix the margin/spacing miscalculation that yields a zero frame width.

Source links

Per-entry sources and capture date are listed at /sources#P29.

Related errors

Related Phaser errors

Need an offline quick-reference checklist?

Atlas error library Pro pack: 123 error references (110 single + 13 merged) plus a quick-fix guide, $19 one-time purchase, delivered as electronic files.

View Pro pack / order

Back to the all-errors index Checkout and buy the Pro pack — $19.00