Description
The ScreenRect
property of the CameraComponent
class represents the size of the viewport in screen coordinates. This property is crucial for determining the area of the screen that the camera will render to, allowing developers to manage how much of the scene is visible through the camera at any given time.
Usage
To use the ScreenRect
property, you can access it directly from an instance of CameraComponent
. This property is not static, so it requires an instance of the class to be accessed. You can both get and set this property to adjust the viewport size as needed.
Example
// Example of accessing and setting the ScreenRect property
CameraComponent cameraComponent = new CameraComponent();
// Get the current screen rectangle
Rect currentScreenRect = cameraComponent.ScreenRect;
// Set a new screen rectangle
cameraComponent.ScreenRect = new Rect(0, 0, 1920, 1080);