Table of Contents

Class SubViewport

Namespace
Godot
Assembly
GodotSharp.dll

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.

public class SubViewport : Viewport, IDisposable
Inheritance
SubViewport
Implements
Inherited Members

Constructors

SubViewport()

public SubViewport()

Properties

RenderTargetClearMode

The clear mode when the sub-viewport is used as a render target.

Note: This property is intended for 2D usage.

public SubViewport.ClearMode RenderTargetClearMode { get; set; }

Property Value

SubViewport.ClearMode

RenderTargetUpdateMode

The update mode when the sub-viewport is used as a render target.

public SubViewport.UpdateMode RenderTargetUpdateMode { get; set; }

Property Value

SubViewport.UpdateMode

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.

public Vector2I Size { get; set; }

Property Value

Vector2I

Size2DOverride

The 2D size override of the sub-viewport. If either the width or height is 0, the override is disabled.

public Vector2I Size2DOverride { get; set; }

Property Value

Vector2I

Size2DOverrideStretch

If true, the 2D size override affects stretch as well.

public bool Size2DOverrideStretch { get; set; }

Property Value

bool

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool