The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I've tried using StyleBoxTextures in my theme but they stretch the borders even with the margins set inward, especially with panels that are in different shapes than the base texture. Is there a way to get them to only stretch the top and bottom borders to the horizontally and to only stretch the left and right borders vertically? That would preserve the border width.

Godot version 3.2.3
in Engine by (8,550 points)

2 Answers

0 votes

As it turns out, that's just how nine patch rects work. If I don't want my image to stretch, I need to create the image at the size intended.

by (8,550 points)
0 votes

No, you should be able to create your 9 patch image and use it for pretty much any size without it appearing distorted. I ran into the same problem as you trying to theme my Buttons with a StyleBoxTexture.

Double check your Margin values for the StyleBoxTexture, generally you want those to match the "corners" for your 9 patch image so the vertical and horizontal edges tile correctly.

If that doesn't help, try it with a NinePatchRect first to see if you can get it to appear correctly. The property to play with there is the Patch Margin.

I hope that helps.

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.