Topic was automatically imported from the old Question2Answer platform.
Asked By
Irrelevant Person
Hey, I want to have a popup menu and I want it open at the same place as its parent node(the button).I made this button and the popupmenu as a seperated scene and put it in the main scene. Somehow the popupmenu appears at coords next to 0(depends on where I placed the button). I tried it by getting the position of the button and set the position of the popupmenu at it but…yeah Im new at working with Godot so…I dont really know what I did and what to do now
The menu can be a child of the button and position it local to the button or make the menu a child of the scene node and set it by the global position.
Thx for that answer, but as I tried it, i …how do you get and set positions. I made:
PopupMenu.set(“position”,position) and position = $button.get_position() and it didnt work
Irrelevant Person | 2020-01-09 14:31
Position is a property so it can be set directly using
PopupMenu.position = $button.get_position()
There’s also the set method.
PopupMenu.set_position($button.get_position())
Magso | 2020-01-09 21:14
I don’t know if there was an update in the past 2 years, but set/get_position do not exist. Instead you should be using the propertyrect_position which is a Vector2.