|
|
|
|
Reply From: |
volzhs |
Button
control does draw text.
If you want to show bbcode inside button,
you can do this way.
make a Button
has RichTextLabel
- Button
- RichTextLabel
override set_text
of Button
extends Button
func _ready():
set_text("[u]asdf[/u] [img]res://icon.png[/img]")
func set_text(text):
get_node("RichTextLabel").set_bbcode(text)
This works only with script, not work with Text field on inspector of Button.
Thanks! I added get_node("RichTextLabel").set_use_bbcode(true)
as well.
Hmm, this does work! I thought the text was going to scale with the button though, but it creates a scrollbar. I guess I have to set the position dynamically based upon text size? If so, this still works fine, thank you @volzhs!
Edit: Hmm, I wonder if I can set the childs with/height to match the parents
wombatTurkey | 2016-05-20 21:06
Looks like this works for the scaling issue, awesome
get_node("RichTextLabel").set_size(Vector2(get_size().width, get_size().height))
wombatTurkey | 2016-05-20 21:09