+1 vote

So I have a Popup menu and I have a label in it, I want the label to display stats like:

Wins: 5
Losses: 8
Ties: 3

Where each stat is on a new line, in a single label. Some languages such as C has a feature where you add in \n in string to go to a new line. How do I do this in GDScript? I'm editing the text from a script.

Godot version Godot Engine v3.4.3.stable
in Engine by (37 points)
edited by

3 Answers

+4 votes
Best answer

Em. Well, it's actually \n

Or you can use triple quotes to make multiline string in script like that:

$Label.text = """Wins: 5
Losses: 8
Ties: 3"""
by (652 points)
selected by
+1 vote

\n is working fine for me. Try get_node(your label).set_text("LINE1\nLINE2")

Edit: someone was 13 seconds faster...

by (30 points)
0 votes

当然是用\n就可以了。。。。。

by (14 points)

Mark this answer as Funny

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.