Material Box

Material Box

WEB Design & Material Images

Godot - Create new Label node

Godot

GDScript code example to create new Label node.


Can create new Label node with Label.new().
Default text color is black for Label node created from script.\r\nAdd with add_child() as child node.

var label = Label.new()
add_child(label)

Label node created with Label.new() displays no text by default.
Need to specify display text, color, position, size etc.

var label = Label.new()
add_child(label)

# Display text
label.text = "Text"
# Position
label.position = Vector2(50, 50)
# Font size
label.add_theme_font_size_override("font_size", 32)
# Text color
label.add_theme_color_override("font_color", Color("#FFF", 1))

Godot

TitleGodot - Create new Label node

CategoryGodot

Created

Update

AuthorYousuke.U