How to setup a RichTextLabel from code?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jason Swearingen

Hi, I am able to create a label no problem:

in c#:

var label = new Label();
label.text = "blah";

however when I try to setup a RichTextLabel the same way, nothing shows. I assume that there is some init like fonts I need to setup, but there doesn’t seem to be a clear way to do so (and docs don’t say)

In the Control portion of the Rich Label you might be able to override the default font with add_font_override(). See the documentation for details.

Ertain | 2020-01-21 01:34

:bust_in_silhouette: Reply From: AlabVix

You have to set the size, for example:

var textLabel: RichTextLabel =
textLabel.rect_size = Vector2(400,400)