Table of Contents

Class ScriptComponentExtensions

Namespace
Stride.CommunityToolkit.Engine
Assembly
Stride.CommunityToolkit.dll

Provides extension methods for ScriptComponent to enhance interactions with game timing and cameras in the GraphicsCompositor.

public static class ScriptComponentExtensions
Inheritance
ScriptComponentExtensions

Methods

DeltaTime(ScriptComponent)

Retrieves the time elapsed since the last game update in seconds.

public static float DeltaTime(this ScriptComponent scriptComponent)

Parameters

scriptComponent ScriptComponent

The ScriptComponent used to access game timing information.

Returns

float

The time elapsed since the last game update, in seconds, as a single-precision floating-point number.

GetFirstGCCamera(ScriptComponent)

Retrieves the first camera from the GraphicsCompositor. Note that the camera might not be available during the first 2-3 frames.

public static CameraComponent GetFirstGCCamera(this ScriptComponent scriptComponent)

Parameters

scriptComponent ScriptComponent

The ScriptComponent from which to access the GraphicsCompositor.

Returns

CameraComponent

The first CameraComponent in the camera collection.

Remarks

Ensure that the GraphicsCompositor is initialized with cameras before calling this method.

GetGCCamera(ScriptComponent)

Retrieves the camera named "Main" from the GraphicsCompositor. Note that the camera might not be available during the first 2-3 frames.

public static CameraComponent? GetGCCamera(this ScriptComponent scriptComponent)

Parameters

scriptComponent ScriptComponent

The ScriptComponent from which to access the GraphicsCompositor.

Returns

CameraComponent

The CameraComponent named "Main", if found; otherwise, null.

Remarks

Ensure that the GraphicsCompositor is initialized with cameras before calling this method, or it may return null.

GetGCCamera(ScriptComponent, string)

Retrieves a camera from the GraphicsCompositor with the specified name. Note that the camera might not be available during the first 2-3 frames.

public static CameraComponent? GetGCCamera(this ScriptComponent scriptComponent, string cameraName)

Parameters

scriptComponent ScriptComponent

The ScriptComponent from which to access the GraphicsCompositor.

cameraName string

The name of the camera to retrieve.

Returns

CameraComponent

The CameraComponent with the specified name, if found; otherwise, null.

Remarks

Ensure that the GraphicsCompositor is initialized with cameras before calling this method, or it may return null.