Texture Tiling/Cropping in a StyleBox?

Godot Version

4.2.2

Question

I’d like to make GUI controls that have a background texture that crops and/or tiles based on the size of the control, so that I can create a single large, repeating texture (for example, a parchment-looking texture) and have each display whatever portion of that texture fits within their actual size, tiling if they’re larger than the texture. Is this possible, and if so, how?

StyleBoxTexture seems specifically designed for 9-patch textures, which stretch out the center of the texture, so that doesn’t do what I want. It does let you tile its texture, but then I can’t control the border the way I could with a StyleBoxFlat, and of course I also can’t control the border of the button with the texture itself that way, since the border would have to be part of the texture. The only other StyleBoxes are Empty, Flat, and Line, none of which seem close to what I want either.

1 Like