I have tried both of these in a node, in the root node, and in my global autoload singleton. I resize the window repeatedly, but the functions never print my debug text, so I guess they never fire.
Is there a better way? Ultimately, I’m trying to fix an off-screen indicator that disappears off the right and bottom screen edges when the window is resized or maximized. I run it in viewport stretch mode, keeping aspect.
get_tree().get_root().size_changed.connect(update_window) # window has been resized
get_viewport().size_changed.connect(update_viewport) # viewport size has changed
Thanks for trying! I get that the pixel dimensions might be considered the same in that mode, but I don’t know why the offscreen indicator would break if the viewport or window weren’t considered different.
Stretch mode means, that the size of the viewport doesn’t change, when the size of the window changes and the Viewport.size_changed signal acts on viewport size changes.
For any future searchers, I had to rethink things because get_viewport().size doesn’t account for window scale. I solved by comparing get_viewport().get_visible_rect().size instead (I wasn’t even aware of that one at the time).