Cannot get Screen Size through script

Godot Version

4.2.2

Question

I want to get the size of the screen through script to get my relative position of my window on the screen. But for some reason, I cannot find any references to a code snippet to get the screen size, except OS.get_screen_size() which doesn’t seem to work in the current version of Godot.

Hi!
Try DisplayServer.screen_get_size(), see DisplayServer — Godot Engine (stable) documentation in English

Works perfectly! Thank You!!!

1 Like