• 2D
  • Viewport - height and width

How to get the Viewport height and width .? So that I can assign it to a variable ..

I get it using viewport.get_visible_rect(). If you don't have your own viewport, you can get the root node: var viewport = get_tree().root

I can also get the size by
var size = get_viewport().get_rect().size But what should I do ..so that I can access the height and width alone.. Should I access the height by - size.y And width by - size.x

To access the screen height - get_viewport_rect().size.y To access the screen width - get_viewport_rect().size.x