This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

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?


Sign In or Register to comment.