reckfellENGINE

SubViewport

An interface to a game world that doesn't create a window or draw to the screen directly.

On this page
class SubViewportReckfellSharpInherits Viewport

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. Note: InputEvents are not passed to a standalone SubViewport by default. To ensure InputEvent propagation, a SubViewport can be placed inside of a SubViewportContainer.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

SubViewportConstructor
# SubViewport
C#
public SubViewport();

Properties6

RenderTargetClearModeProperty
# RenderTargetClearMode
C#
public SubViewport.ClearMode RenderTargetClearMode { get; set; }

The clear mode when the sub-viewport is used as a render target. Note: This property is intended for 2D usage.

RenderTargetUpdateModeProperty
# RenderTargetUpdateMode
C#
public SubViewport.UpdateMode RenderTargetUpdateMode { get; set; }

Controls render-target redrawing: Disabled keeps the last frame, Always draws continuously, and Once requests one frame. It does not pause scripts or physics. In the current build the getter retains Once after the draw even though RenderingServer has stopped repeated rendering. Assigning Once again requests another frame; do not wait for the getter to become Disabled as a completion signal.

SizeProperty
# Size
C#
public Vector2I Size { get; set; }

Viewport output size in pixels. Scaling3DScale changes internal 3D resolution separately: Size=(512,384) with scale 0.5 still yields a 512×384 GetTexture result. Change Size to resize output, accounting for UI and target dimensions.

Size2DOverrideProperty
# Size2DOverride
C#
public Vector2I Size2DOverride { get; set; }

Logical 2D area in pixels. Enable Size2DOverrideStretch to stretch it into the output target. Changes canvas coordinate mapping, not the output texture Size.

Size2DOverrideStretchProperty
# Size2DOverrideStretch
C#
public bool Size2DOverrideStretch { get; set; }

Enables stretching the logical Size2DOverride area into output Size. For example, a 64 by 48 canvas can fill a 128 by 96 target without changing output texture dimensions.

ViewCountProperty
# ViewCount
C#
public int ViewCount { get; set; }

The number of view layers we are rendering to. Set this to 2 to enable stereo rendering.

Methods12

GetClearModeSubViewport.ClearMode
# GetClearMode
C#
public SubViewport.ClearMode GetClearMode();
Returns SubViewport.ClearMode
GetSizeVector2I
# GetSize
C#
public Vector2I GetSize();
Returns Vector2I
GetSize2DOverrideVector2I
# GetSize2DOverride
C#
public Vector2I GetSize2DOverride();

Returns the requested Size2DOverride value. Logical 2D area in pixels. Enable Size2DOverrideStretch to stretch it into the output target. Changes canvas coordinate mapping, not the output texture Size.

Returns Vector2I

Value of Size2DOverride; account for the documented distinction between a setting and its effective result.

GetUpdateModeSubViewport.UpdateMode
# GetUpdateMode
C#
public SubViewport.UpdateMode GetUpdateMode();

Returns the requested RenderTargetUpdateMode value. Texture update policy. Disabled retains the frame; Always renders even without visible use; Once requests one frame. The scene getter retains Once after consumption, so it is not a completion indicator. Assign Once again to request another frame. Does not pause Entity processing.

Returns SubViewport.UpdateMode

Value of RenderTargetUpdateMode; account for the documented distinction between a setting and its effective result.

GetViewCountint
# GetViewCount
C#
public int GetViewCount();
Returns int
IsSize2DOverrideStretchEnabledbool
# IsSize2DOverrideStretchEnabled
C#
public bool IsSize2DOverrideStretchEnabled();

Returns the requested Size2DOverrideStretch value. Enables stretching the logical Size2DOverride area into output Size. For example, a 64 by 48 canvas can fill a 128 by 96 target without changing output texture dimensions.

Returns bool

Value of Size2DOverrideStretch; account for the documented distinction between a setting and its effective result.

SetClearModevoid
# SetClearMode
C#
public void SetClearMode(SubViewport.ClearMode mode);
Parameters
NameTypeDefault
modeSubViewport.ClearMode—
SetSizevoid
# SetSize
C#
public void SetSize(Vector2I size);
Parameters
NameTypeDefault
sizeVector2I—
SetSize2DOverridevoid
# SetSize2DOverride
C#
public void SetSize2DOverride(Vector2I size);

Sets Size2DOverride. Logical 2D area in pixels. Enable Size2DOverrideStretch to stretch it into the output target. Changes canvas coordinate mapping, not the output texture Size.

Parameters
NameTypeDefault
sizeVector2I—
size

Logical 2D area in pixels. Enable Size2DOverrideStretch to stretch it into the output target. Changes canvas coordinate mapping, not the output texture Size.

SetSize2DOverrideStretchvoid
# SetSize2DOverrideStretch
C#
public void SetSize2DOverrideStretch(bool enable);

Sets Size2DOverrideStretch. Enables stretching the logical Size2DOverride area into output Size. For example, a 64 by 48 canvas can fill a 128 by 96 target without changing output texture dimensions.

Parameters
NameTypeDefault
enablebool—
enable

Enables stretching the logical Size2DOverride area into output Size. For example, a 64 by 48 canvas can fill a 128 by 96 target without changing output texture dimensions.

SetUpdateModevoid
# SetUpdateMode
C#
public void SetUpdateMode(SubViewport.UpdateMode mode);

Sets RenderTargetUpdateMode. Texture update policy. Disabled retains the frame; Always renders even without visible use; Once requests one frame. The scene getter retains Once after consumption, so it is not a completion indicator. Assign Once again to request another frame. Does not pause Entity processing.

Parameters
NameTypeDefault
modeSubViewport.UpdateMode—
mode

Texture update policy. Disabled retains the frame; Always renders even without visible use; Once requests one frame. The scene getter retains Once after consumption, so it is not a completion indicator. Assign Once again to request another frame. Does not pause Entity processing.

SetViewCountvoid
# SetViewCount
C#
public void SetViewCount(int viewCount);
Parameters
NameTypeDefault
viewCountint—

SubViewport.ClearMode

ValueDescription
Always = 0

Always clear the render target before drawing.

Never = 1

Never clear the render target.

Once = 2

Clear the render target on the next frame, then switch to SubViewport.ClearMode.Never.

SubViewport.UpdateMode

ValueDescription
Always = 4

Always update the render target.

Disabled = 0

Do not update the render target.

Once = 1

Update the render target once, then switch to SubViewport.UpdateMode.Disabled.

WhenParentVisible = 3

Update the render target only when its parent is visible.

WhenVisible = 2

Update the render target only when it is visible. This is the default value.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.