Hi guys:
How do you bind click event for gui?
regards
Do you mean clicking on a GUI node?
Make sure your GUI script has input.
Typically on init
msg.post(".", "acquire_input_focus")
Then in on input, or elsewhere, such as on update in some designs (you would pass the action values to on update somehow so they are consolidated once per frame).
local my_node = gui.get_node("my_node_name")
if gui.pick_node(my_node, action.x, action.y) and action.released and action_id == hash("touch") then
-- do click event for that GUI node
end
3 Likes
Great, that’s helpful. Thx.
2 Likes