Description
The r
field represents the red component of a color in the Color
struct. It is a floating-point value that typically ranges from 0 to 1, where 0 represents no red and 1 represents full red intensity. However, this value can exceed 1, allowing for high dynamic range (HDR) color representations.
Usage
To access or modify the red component of a Color
instance, you can directly use the r
field. This field is public and non-static, meaning it is accessed through an instance of the Color
struct.
Example
Color myColor = new Color();
myColor.r = 0.5f; // Set the red component to 50% intensity
// Accessing the red component
float redIntensity = myColor.r;
// Example of exceeding the typical range
myColor.r = 1.5f; // HDR value, exceeds the standard 0-1 range