Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | smaran |
How could I change BY CODE the viewport size to fit different physical screen dimensions and aspect ratios?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | smaran |
How could I change BY CODE the viewport size to fit different physical screen dimensions and aspect ratios?
Reply From: | Gluon |
Well I havent implemented the code below but according to the documentation ( see here Using Viewports — Godot Engine (stable) documentation in English ) this should work,
Var Width_Set = 0
var Height_Set = 0
viewport.set_size_override(true, Vector2(Width_Set, Height_Set)) # Custom size for 2D.
viewport.set_size_override_stretch(true) # Enable stretch for custom size.
Tie the Width_Set and Height_Set variables into some user inputs and you should be able to set the size. If you check the website I directed too though it should give you more info.
Thanks but your suggestion didn’t work.
smaran | 2021-08-17 18:07