In my game.project settings the display resolution is set to 540x720. I have a display profile for portrait that is 1080x1440. Graphically my buttons is in the correct position when using the portrait profile but when I use gui.pick_node() the node is detected as if the GUI was scaled with the default profile.
The red rings represent the buttons position for pressing.
It did not help. It looks like the problem is that the action.x and action.y values are based on the default display profile instead of the active one.
The issue is resolved and tested and will be included in the next release (1.2.58).
Your code is correct, but if you need to get this working until next release, here’s a workaround (note that this won’t work when you do start using the next release!).
local x = (gui.get_width() / 540) * action.x
local y = (gui.get_height() / 720) * action.y
self.box_hit = gui.pick_node(self.box, x, y)
Obviously, if you change the project settings display width and height, you need to alter the hard-coded values