system
July 15, 2020, 3:56pm
1
Attention
Topic was automatically imported from the old Question2Answer platform.
Asked By
Gustavo Loureiro dos
I was following this tutorial on Youtube https://www.youtube.com/watch?v=PTt9v452BVw
and at some point he used an ‘AcceptDialog’. However, I’ve noted it starts with the text aligned left. I’m still quite new to the engine, so I tried adding a theme and fiddling with some options, but I got lost and this frustrated me a lot.
It’s something SO simple, and yet I can’t find a simple way to do it…
system
July 15, 2020, 8:57pm
2
Reply From:
Friends-Games
You can’t, I’ve checked the documentation and it can’t be centered.
Yeah, I saw it as well, but just needed some confirmation. Thank you!
Gustavo Loureiro dos | 2020-07-16 17:01
system
July 16, 2020, 5:14pm
3
Reply From:
njamster
You can from code:
extends AcceptDialog
func _ready():
get_child(1).align = HALIGN_CENTER
The child-id might change though if you add children to the AcceptDialog yourself.
Reply From:
mustafamax
You can remove
AcceptDialog.visible = true
and add
AcceptDialog.popup_centered()
Magodra
December 21, 2023, 12:42pm
5
In Godot 4.x:
%ConfirmationDialog.dialog_text = "Confirmations needed!"
%ConfirmationDialog.get_child(1, true).horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
%ConfirmationDialog.popup()