Inherits: Viewport < Node < Object
An interface to a game world that doesn't create a window or draw to the screen directly.
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.
| ||
| ||
| ||
| ||
|
0
Always clear the render target before drawing.
1
Never clear the render target.
2
Clear the render target on the next frame, then switch to CLEAR_MODE_NEVER.
0
Do not update the render target.
1
Update the render target once, then switch to UPDATE_DISABLED.
2
Update the render target only when it is visible. This is the default value.
3
Update the render target only when its parent is visible.
4
Always update the render target.
0
The clear mode when the sub-viewport is used as a render target.
Note: This property is intended for 2D usage.
2
The update mode when the sub-viewport is used as a render target.
Vector2i(512, 512)
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(0, 0)
The 2D size override of the sub-viewport. If either the width or height is 0, the override is disabled.
false
If true, the 2D size override affects stretch as well.
© 2014–present Juan Linietsky, Ariel Manzur and the Godot community
Licensed under the Creative Commons Attribution Unported License v3.0.
https://docs.godotengine.org/en/4.2/classes/class_subviewport.html