Godot Version
3.6
Question
So I want to change screen size, cause I’m adding many stuff to my scene, I’ve tried:
func _ready():
print(get_viewport_rect().size)
get_viewport_rect().size = Vector2(500, 600)
get_viewport_rect().expand(Vector2(2,2))
print(get_viewport_rect().size)
But I’m gettin this:
(480, 720)
(480, 720)
So, screen size is not changing for some reason?
Ok this method is workin (set_screen_stretch):
void set_screen_stretch ( StretchMode mode, StretchAspect aspect, Vector2 minsize, float scale=1 )
Like this:
var curr_screen_size: Vector2 = get_viewport_rect().size
var new_screen_vec_x: float = curr_screen_size.x + 20
var new_screen_vec_y: float = curr_screen_size.y + 20
get_tree().set_screen_stretch(1, 4, Vector2(new_screen_vec_x, new_screen_vec_y))
system
Closed
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.