CyberMax
Home › Glossary › Game assets

What is 9-slice (nine-patch) scaling?

Game assets glossary · 2 primary sources

A way to stretch a UI panel or button to any size by cutting it into 9 parts: the corners never scale, the edges stretch in one direction and the centre fills the rest.

You set four margins (left, top, right, bottom) that mark the corners. The result keeps crisp borders at any size, so one small image serves every dialog box. Godot uses NinePatchRect or a StyleBoxTexture with texture margins; Unity sets the border in the Sprite Editor and uses an Image of type Sliced.

For pixel art, keep the stretch mode on tile rather than stretch if the edge has a pattern, and keep the panel size a multiple of the pattern.

Sources

Related terms

On this site

All game assets terms · Full glossary