Description
The CustomSize
property of the CameraComponent
class allows you to specify a custom aspect ratio for the camera. By default, the camera size is determined by the screen size or the render target size. This property is useful when you need to override the default behavior and set a specific aspect ratio for rendering purposes.
Usage
To use the CustomSize
property, assign a Vector2
value representing the desired width and height ratio. If you do not set this property, the camera will use the default screen or render target size.
Example
// Example of setting a custom aspect ratio for a camera
CameraComponent camera = new CameraComponent();
camera.CustomSize = new Vector2(16, 9); // Set a 16:9 aspect ratio
// To reset to default behavior
camera.CustomSize = null;