How to size a RichTextLabel to it's contents

duendecatduendecat Posts: 5Member

Hi. I've been trying for a few hours to get a the bounds of a RichTextLabel to size dynamically to the text inside of it. I feel like this should be something very simple to achieve, so maybe I'm missing something.

The idea is that when the player performs certain actions such as picking up something, some text (dynamically generated) should fade in with a semi-transparent background behind it. The background should match the size of the text, so therefore the RichTextLabel can't be set to a fixed width.

I've tried many things so far, including using BBCode (the background tag doesn't seem to be supported in Godot), styleboxes, placing the label inside of it's own canvas layer, a TextureRect as a child node, images etc, but so far there doesn't seem to be any way to get Godot to simply place some text on the screen with a background that fits the text. Can anyone help, please?

Comments

Sign In or Register to comment.