Can I make a Texture button with a Patch9Frame functionnality ?

linkoboylinkoboy Posts: 4Member


I would like to do several texture buttons with several size with a "9 patch frame" texture on it, the texturebutton class offers for example scale of the texture, but it stretch the texture and I would not, and I can't specify patch margin in it.

I would like a button like the green one (9 patched independent of the size with no stretch) in the image below.

Is there a way to do this ?



  • greyspotgreyspot Posts: 2Member

    I believe 9 patch is being added to Godot 3.0 so you'll have to do it manually for the time being.

  • 1000h1000h Posts: 133Member
    edited September 2017

    there is a patch 9 in 2.1 but you would need to write your own button functions for it because its not connected to basebutton class (detecing inputs from within processing script) -i think

  • CalinouCalinou Posts: 131Admin Godot Developer

    Just use a standard Button node, then apply custom styles to it (which lets you use patch-9 textures).

    Note that Godot 3.0 will support more extended texture-less GUI theming options (StyleBoxFlat): rounded/beveled corners, per-border widths and drop shadows will all be possible, which makes resorting to textures less needed.

  • linkoboylinkoboy Posts: 4Member

    Thanks for your answers,

    For the moment, I've created a base scene "patch_button.scn" like in the screenshot : it's surely not the best solution but it give the fonctionnalities that I need.

    I'm looking forward to seeing the new features of Godot 3.0, it looks great !

Sign In or Register to comment.