Description
The FromRgba
method creates a Color32
instance from a 32-bit unsigned integer representing a color in RGBA format. The integer is expected to be in the form 0xRRGGBBAA
, where each pair of hexadecimal digits represents the red, green, blue, and alpha components of the color, respectively.
Usage
Use this method when you need to create a Color32
object from a packed RGBA integer value. This is particularly useful when dealing with color data stored in a compact format, such as when reading from a binary file or a network stream.
Example
// Example of using Color32.FromRgba
uint rgbaValue = 0xFF00FF80; // Purple color with 50% transparency
Color32 color = Color32.FromRgba(rgbaValue);
// Accessing individual color components
byte red = color.r; // 255
byte green = color.g; // 0
byte blue = color.b; // 255
byte alpha = color.a; // 128