Class SubViewport
An interface to a game world that doesn't create a window or draw to the screen directly.
- Inheritance
-
SubViewport
Remarks
SubViewport Isolates a rectangular region of a scene to be displayed independently. This can be used, for example, to display UI in 3D space.
Note: SubViewport is a Viewport that isn't a Window, i.e. it doesn't draw anything by itself. To display anything, SubViewport must have a non-zero size and be either put inside a SubViewportContainer or assigned to a ViewportTexture.
Note: InputEvents are not passed to a standalone SubViewport by default. To ensure InputEvent propagation, a SubViewport can be placed inside of a SubViewportContainer.
See Also
Properties
render_target_clear_mode
The clear mode when the sub-viewport is used as a render target.
Note: This property is intended for 2D usage.
var render_target_clear_mode : int = 0
Property Value
Remarks
render_target_update_mode
The update mode when the sub-viewport is used as a render target.
var render_target_update_mode : int = 2
Property Value
Remarks
size
The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.
Note: If the parent node is a SubViewportContainer and its stretch is true
, the viewport size cannot be changed manually.
var size : Vector2i = Vector2i(512, 512)
Property Value
Remarks
size_2d_override
The 2D size override of the sub-viewport. If either the width or height is 0
, the override is disabled.
var size_2d_override : Vector2i = Vector2i(0, 0)
Property Value
Remarks
size_2d_override_stretch
If true
, the 2D size override affects stretch as well.
var size_2d_override_stretch : bool = false