I need to make it display rich text like this:
"You got Apple!"
where the "" is a custom texture called apple.png in my project folder.
I tried using the [img] tag but it makes the text and apple icon misaligned.
How to display icons inside a Richtextlabel?
- Edited
Try using the table and cell tags.
This example assumes that the path for the image is res://apple.png
:
[table=3]
[cell]You got[/cell]
[cell][img]res://apple.png[/img][/cell]
[cell]Apple![/cell]
[/table]
https://docs.godotengine.org/en/4.4/tutorials/ui/bbcode_in_richtextlabel.html#reference
DaveTheCoder
no luck. it results in the same thing although now it misaligns the words as well.
- Edited
Try adjusting the dimensions of the image to match the text. You can specify the image width and height using BBCode in Godot 3:
https://docs.godotengine.org/en/3.6/tutorials/ui/bbcode_in_richtextlabel.html#reference
Godot 4 has enhancements to BBCode that appear to do exactly what you want:
https://docs.godotengine.org/en/4.4/tutorials/ui/bbcode_in_richtextlabel.html#image-and-table-vertical-alignment
Alternatively, you could create an image outside of Godot that contains the text and the apple, and then display that image in Godot.