Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henriquelalves/d1f687d7e73527762098921c1f116403 to your computer and use it in GitHub Desktop.
Save henriquelalves/d1f687d7e73527762098921c1f116403 to your computer and use it in GitHub Desktop.
Recursive search for viewport on Godot
func find_viewport(node, recursive_level):
if node.get_type() == "CanvasItemEditor":
return node.get_child(1).get_child(0).get_child(1).get_child(1)
else:
recursive_level += 1
if recursive_level > 15:
return null
for child in node.get_children():
var result = find_viewport(child, recursive_level)
if result != null:
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment