Hello all,
I have a game scene and when the user push "enter" I want to show a panel container with information about the environemnt.
The panel container and it's childs are stored as a scene, called baseOverlay, it' layout is set to "Top-Wide"
As I want to reuse the overlay for all other scenes as well I don't want to add the scene for every other scenes . So, I load it from code dynamically:
I instantiate the scene in Player scene which is also a child of the scene
const BaseOverlay = preload("res://Scenes/BaseOverlay.tscn")
func push_button(interactables, prey):
var overlay = BaseOverlay.instance()
get_parent().add_child(overlay)
overlay.init(interactables, prey)
Scene shows up but is centered in the middle of the parent scene (Pos 0,0) and ignores the layout setting completely.
My question:
How can I use the layout settings "Top-Wide" at runtime.
I've tried to set preset "Top-wide" in ready function of the BaseOverlay itself, but it does nothing.
func _ready():
set_anchors_and_margins_preset(10)
Any ideas how I can add a container scene dynamically and set it to top left position of the current screen (and not a fixe position in parent scene)
Thanks a lot
Regards