How to use custom BBCode in RichTextLabel

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sjbcastro

Hi all,

I’ve been playing around with the RichTextLabel, specifically with the BBCode functionality. I’ve read that you can define your own custom BBCodes here: BBCode in RichTextLabel — Godot Engine (3.2) documentation in English

There are a couple of examples provided, but there doesn’t seem to be any info on how to actually use custom BBCodes in one’s GoDot project. Being new to GoDot, I naively tried pasting the example code into a script called ‘’ and using the [ghost] BBCode in the RichTextLabel. However, unlike the other built-in BBCodes, writing something like “[ghost]test[/ghost]” gets rendered as-is, i.e. the code is not recognised, parsed and removed from the output. Is there some step that I am missing? Any help would be much appreciated.

P.S. My original aim was to get superscript/subscript text. Would still be good to know how to use custom bbcodes (can see this being super useful for all sorts of reasons), but if there is a quicker way to get superscript/subscript working that’d also be great to know.

:bust_in_silhouette: Reply From: njamster

You have to create a resource (i.e. a file ending “.tres”) to which the script is attached to. Then you can this resource in the Inspector of the RichTextLabel under “Custom Effects”. This video shows you how to do it.

Thanks for the fast reply, will give it a try :slight_smile:

sjbcastro | 2020-05-03 20:30