Work in progress
Godot documentation is being updated to reflect the latest changes in version
4.0. Some documentation pages may
still state outdated information. This banner will tell you if you're reading one of such pages.
The contents of this page are up to date. If you can still find outdated information, please open an issue.
Inherits: Viewport < Node < Object
Creates a sub-view into the screen.
SubViewport is a Viewport that isn't a Window, i.e. it doesn't draw anything by itself. To display something, SubViewport's size must be non-zero and it should be either put inside a SubViewportContainer or assigned to a ViewportTexture.
ClearMode CLEAR_MODE_ALWAYS =
Always clear the render target before drawing.
ClearMode CLEAR_MODE_NEVER =
Never clear the render target.
ClearMode CLEAR_MODE_ONCE =
Clear the render target on the next frame, then switch to CLEAR_MODE_NEVER.
UpdateMode UPDATE_DISABLED =
Do not update the render target.
UpdateMode UPDATE_ONCE =
Update the render target once, then switch to UPDATE_DISABLED.
UpdateMode UPDATE_WHEN_VISIBLE =
Update the render target only when it is visible. This is the default value.
UpdateMode UPDATE_WHEN_PARENT_VISIBLE =
Update the render target only when its parent is visible.
UpdateMode UPDATE_ALWAYS =
Always update the render target.
ClearMode 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.
UpdateMode render_target_update_mode =
void set_update_mode ( UpdateMode value )
UpdateMode get_update_mode ( )
The update mode when the sub-viewport is used as a render target.
Vector2i 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 SubViewportContainer.stretch is
true, the viewport size cannot be changed manually.
Vector2i size_2d_override =
The 2D size override of the sub-viewport. If either the width or height is
0, the override is disabled.
bool size_2d_override_stretch =
true, the 2D size override affects stretch as well.