0 votes

I think everything is clear. Can I add a icon to a label or richtextlabel

asked May 26 in Engine by start123 (43 points)

1 Answer

0 votes

https://docs.godotengine.org/en/stable/classes/class_richtextlabel.html

add_image() would do the job, just remember that it requires a texture and not a picture

var t=Texture.new()
t=load("res://icon.png")
add_image(t,10,10)
answered May 26 by Andrea (519 points)

Does this need to be written in a richtextlabel script?

either that or you reference another richtextlabel object, like richtextlabel.add_image(t,10,10)
As many other coding langues, in Godot all the functions (methods) are linked to an object (nodes): you can refer to any node (and call its related methods) from every piece of script, you just have to specify it before the "."
If you dont specify it, Godot assumes you are referencing the same node the script is attached to

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 How to use this Q&A? before posting your first questions.