OS.get_window_size on Godot 4 isn't working.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Curiously99

This function is from the ‘Game Programming and Positioning: Basics Of Coding - Godot Basics Tutorial - episode 26’, so it was most likely written for Godot, 3, not 4. Also, Godot help me, I’m on a Chrome Book, does that impact the “OS” bit of the code?

Basically, I’m brand new to game coding, and this function is bugging as:
"Can’t find member “get_” in Base “OS”.

Not a clue, please help.

:bust_in_silhouette: Reply From: Curiously99

Actually, should have kept searching.

This work’s just fine, (for the x axis).

get_viewport().size.x

:bust_in_silhouette: Reply From: Leon12

Hi!

I’ve found also found working:

@onready var window : Window = get_window()

func _ready():
	WINDOW_SIZE = window.size