When I attempt to pick a gui node within roughly 20 frames of having created the gui-object it results in the gui object becoming disabled (as if it was set_enabled false). It is only a problem on the first pick, so my workaround is to put this into my init-function:
I’m not really able to reproduce this. Is this for a cloned node or a node that existed from the start? I did this:
function init(self)
self.frame_count = 0
self.box = gui.get_node("box")
self.box_pos = gui.get_position(self.box)
end
function update(self, dt)
print("ENABLED", gui.is_enabled(self.box))
self.frame_count = self.frame_count + 1
if self.frame_count == 20 then
print("PICKING NODE")
gui.pick_node(self.box, self.box_pos.x, self.box_pos.y)
end
end
And from the output you can see that the node remains enabled:
There is a bug (DEF-1605) that could possibly show like this, a fix for it is coming in todays beta and will land in stable this monday. Are you on Windows?
Ah, I see. @Mathias_Westerdahl mentioned to me that there’s a fix for an issue with an uninitialised variable and parent nodes coming in the next beta release later today. This fix could very likely be related to what you are seeing Emil. I suggest that we wait until the beta and try again.
Yes, I feel very confident it’s the issue DEF-1605 that should be fixed with todays’ beta release.
You can verify it by adding an extra line (which should make the bug go away):
gui.pick_node(parent_node, 0, 0) -- Updates the parent's local transform
gui.pick_node(node, 0, 0)