How to use tiles for your dialog box borders in Godot: The NinePatchRect component

Senior Full Stack Developer in the ☁️
Creator of supereffective.gg, a Pokémon community running on Next.js and @vercel
Search for a command to run...

Senior Full Stack Developer in the ☁️
Creator of supereffective.gg, a Pokémon community running on Next.js and @vercel
No comments yet. Be the first to comment.
Collection of articles and tutorials about Game Development in Godot, specially RPG games in 2D
In this video tutorial I'll show you a trick to give proper colors to the collision shapes in Godot because, by default, the tint color gets mixed with the default one which unfortunately is not white. https://www.youtube.com/watch?v=5TUeWl_O0kE?star...
In this case, using the scroll event offers more flexibility than using the IntersectionObserver API
Feeling the web developer fatigue? You are not alone!

The IntersectionObserver is a powerful API for tracking elements' visibility within the viewport. Many modern web applications use it to implement lazy loading, infinite scrolling, or other interactions that depend on an element's visibility. When it...
The addon system has been completely rewritten, so now you can also provide your own or turn off default ones. The UI also looks much better, especially on mobile. The styles have been reworked so the look and feel are more similar to StoryBook's UI....

Lightweight drop-in app for rapid React component development and visualisation

The other day I was looking for the counterpart of the Unity Panel’s tiled image mode but it didn’t seem an easy thing to find. Lots of tutorials cover how to make your own themes, but it was hard to find how to use tiles for the borders in Godot.
When you build a tile-based game it’s what you usually want for your UI: too look pixel-perfect with that retro look.
Here is the example in Unity:

In the Panel component in Unity, you have the option of using a “Tiled” image type easily. As you can see, it detects the 9 tiles automatically.
After some more digging, it turns out that in Godot Engine you have a very powerful and customisable component (even more than in Unity) called NinePatchRect. With it, you can use any texture and slice the region you are interested in to use it as the borders of your panels / dialog boxes.
The important inspector settings are:
Here is an example:

Basic NinePatchRect configuration in Godot for 16x16 px tiles