Description
The ScreenRect
property of the CameraComponent
class represents the size of the viewport in screen coordinates. This property is useful for determining the area of the screen that the camera is rendering to, which can be important for UI layout, rendering calculations, and other screen-space operations.
Usage
To access the ScreenRect
property, you need to have an instance of the CameraComponent
. You can then get or set the ScreenRect
to define or retrieve the current viewport size in screen coordinates.
Example
// Assuming 'cameraComponent' is an instance of CameraComponent
Sandbox.Rect currentScreenRect = cameraComponent.ScreenRect;
// Example of setting a new screen rect
cameraComponent.ScreenRect = new Sandbox.Rect(0, 0, 1920, 1080);