Description
The Rect
property of the SceneCamera
class specifies the portion of the screen that the camera will render to. This is a normalized rectangle, meaning its values range from 0 to 1, representing a percentage of the screen's width and height. This allows for flexible rendering setups, such as rendering to a specific portion of the screen or creating split-screen effects.
Usage
To use the Rect
property, you can set it to a new Rect
object with normalized coordinates. For example, setting the Rect
to new Rect(0, 0, 0.5f, 0.5f)
would render the camera's view to the bottom-left quarter of the screen.
Example
// Create a new SceneCamera
SceneCamera camera = new SceneCamera();
// Set the Rect to render to the top-right quarter of the screen
camera.Rect = new Rect(0.5f, 0.5f, 0.5f, 0.5f);
// This will render the camera's view to the specified portion of the screen.