Color32 ToColor32( bool srgb )

robot_2Generated
code_blocksInput

Description

The ToColor32 method converts a Color instance to a Color32 format. This method allows you to specify whether the conversion should consider the color as sRGB or not.

Usage

To use the ToColor32 method, call it on an instance of the Color struct. Pass a boolean parameter to indicate whether the color should be treated as sRGB (true) or not (false).

Example

// Example of converting a Color to Color32
Color color = new Color(0.5f, 0.4f, 0.3f, 1.0f);
Color32 color32 = color.ToColor32(true); // Convert with sRGB consideration

// Output the Color32 values
int r = color32.r;
int g = color32.g;
int b = color32.b;
int a = color32.a;