Hello all
after reading this : relative-addressing
and this GUI
I have simple scene ( from mobile example ) on top of this i added GUI collection with script that should capture only the button on the GUI collection .
but i have 2 problems
1 .when i click the button on the GUI collection the event propagate also to the main collection .
which i like prevent .
and when i click on the main.collection icon it propagate to the GUI collection .
This is i want to prevent . each button will handle its own event without Propagation .
2. I try to send massage to the GUI collection so it will hide . but i canât find how to call the gui collection
i try to :
msg.post("guis#box_button_parent","hide_level_select") msg.post("#box_button_parent","hide_level_select")
But i gives me error :
ERROR:GAMEOBJECT: Component â/guis#box_button_parentâ could not be found when dispatching message âhide_level_selectâ sent from main:/go#main
This is my main script :
function init(self)
msg.post(".", "acquire_input_focus")
msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed then
print("Touch!")
msg.post("guis#box_button_parent","hide_level_select")
end
end
And this is my level_select.gui â select_level.gui_script
function init(self)
msg.post(".","acquire_input_focus")
msg.post("#","show_level_select")
self.active = false
end
function on_message(self, message_id, message, sender)
if message_id == hash("show_level_select") then
msg.post("#","enable")
self.active = true
elseif message_id == hash("hide_level_select") then
msg.post("#","disable")
self.active = false
end
end
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed and self.active then
print("button pressed1111")
end
end
also when i add âreturn trueâ in the select_level.gui_script on_input function
like this:
function on_input(self, action_id, action)
if action_id == hash("touch") and action.pressed and self.active then
print("button pressed1111")
return true
end
end
it prevent me to capture the on_input from the main.script âŚ
Here is the root nootdi try to msg to from main script:
Thanks for help .
UPDATE
Found how to post msg like this:
msg.post(âmain:/guis#level_selectâ, âhide_level_selectâ)
But the question with "prevent Propagation " still not solved