Quick answer: Extend RichTextEffect, set resource_local_to_scene = true and bbcode = "myfx". Override _process_custom_fx(CharFXTransform). Add an instance to RichTextLabel custom_effects.
Custom [shake] tag in your text does nothing. RichTextEffect resource isn’t in the label’s effects list, or the override method isn’t connected.
The Symptom
BBCode tags wrap text but produce no visual effect. Built-in tags like [shake] work. Custom one doesn’t.
The Fix
# Custom effect resource
extends RichTextEffect
class_name RichTextWobble
@export var bbcode := "wobble"
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
var amp := float(char_fx.env.get("amplitude", 5))
var speed := float(char_fx.env.get("speed", 2))
char_fx.offset.y = sin(char_fx.elapsed_time * speed + char_fx.range.x * 0.3) * amp
return true
Save as res://wobble_effect.tres (a RichTextWobble resource).
On RichTextLabel:
RichTextLabel:
bbcode_enabled: true
custom_effects: [wobble_effect.tres]
text: "Hello [wobble amplitude=8 speed=4]world[/wobble]!"
The bbcode property on the resource matches the tag name. _process_custom_fx fires per character per frame.
Per-Char Color
func _process_custom_fx(c: CharFXTransform) -> bool:
c.color = Color.from_hsv(fmod(c.elapsed_time + c.range.x * 0.05, 1.0), 1.0, 1.0)
return true
Rainbow per-character.
Verifying
Run the scene. Text should wobble. If still static, check: bbcode tag matches resource’s bbcode property; resource is in custom_effects; bbcode_enabled is true.
“Resource with bbcode name. _process_custom_fx. Added to custom_effects. Letters dance.”
Related Issues
For BBCode parsing, see BBCode parsing. For shader uniform runtime, see shader uniform.
Effect resource. bbcode name. Process per char.