This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi,

I am new here, and in Godot, and also in Game development. I try to create a label using GDScript and apply a custom_styles/normal on it. I can't find any documentation or post anywhere that explain it.

I already created the ".tres" style.

Any Idea?

    var label: Label = Label.new()
    label.set_text("Example")
    label.set("custom_styles/normal", "res://path_to_tres/example.tres")

Thanks,

Godot version v3.3.3.stable.official
in Engine by (15 points)

1 Answer

0 votes
Best answer

You also need to load the resource by calling the load() function and passing that path as a parameter.

by (8,580 points)
selected by

Hi,
It works!
Thanks,

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.