Godot Version
4.2.1
Question
I am having trouble figuring out how to get the viewport size in C#. When I call GetViewport() there is no size property available. Any ideas?
Sorry for bumping this months old question. I have the same question but this answer does not work for C# for 3D nodes as there is no GetViewportRect(). GetWindow().Size only returns the width and the height of the main window in pixels, even when positioned under another viewport node.
I found the answer in the docs. It’s
GetViewport().GetVisibleRect().Size
which returns the width and the height of the viewport in pixels. The camera then provides a Size which seems to describe the square length in which the viewport rectangle is contained.