Description
The r
field represents the red component of a color in the Color
struct. It is a floating-point value typically ranging from 0 to 1, where 0 represents no red and 1 represents full red. 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
// Example of setting the red component of a Color
Color myColor = new Color();
myColor.r = 0.5f; // Set the red component to 50%
// Example of getting the red component of a Color
float redValue = myColor.r; // Get the current red component value