0 votes

So I'm trying to change what a label says through script, but it overlaps some other parts of my game but I don't know how to make a new text line in script.

For example:

$Node2D/HSplitContainer/Hair/HairButtons/Label.text = "Coleur de Cheveux"

Overlaps part of the game which needs to be shown. Is there a way to make it appear like this in the editor?

Coleur de
 Cheveux
Godot version 3.4
in Engine by (15 points)

1 Answer

+2 votes
Best answer

The \n escape sequence allows you to write a line break in a string.

Here, you'd need to use the following syntax:

$Node2D/HSplitContainer/Hair/HairButtons/Label.text = "Coleur de\n Cheveux"
by (12,717 points)
selected by

Thanks for the response! Worked perfectly! Now it'll be a lot easier to translate from English :)

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.