ViewportContainer

Inherits: Container < Control < CanvasItem < Node < Object

Control for holding Viewports.

Description

A Container node that holds a Viewport, automatically setting the viewport's size.

Note: Changing a ViewportContainer's Control.rect_scale will cause its contents to appear distorted. To change its visual size without causing distortion, adjust the node's margins instead (if it's not already in a container).

Properties

bool

stretch

false

int

stretch_shrink

1


Property Descriptions

bool stretch = false

  • void set_stretch ( bool value )

  • bool is_stretch_enabled ( )

If true, the viewport will be scaled to the control's size.


int stretch_shrink = 1

  • void set_stretch_shrink ( int value )

  • int get_stretch_shrink ( )

Divides the viewport's effective resolution by this value while preserving its scale. This can be used to speed up rendering.

For example, a 1280×720 viewport with stretch_shrink set to 2 will be rendered at 640×360 while occupying the same size in the container.

Note: stretch must be true for this property to work.