Skip to content

format

typescript
Color.Set(index, value)

class: Color

description

Get the color component based on the given index.

This method is commonly used to adjust the color of materials, graphics, or particle effects to achieve different visual effects.

parameter

param_nametypedescription
indexnumber0 to set the red component (range from 0 to 1); 1 to set the green component (range from 0 to 1); 2 to set the blue component (range from 0 to 1); 3 to set the alpha component (0 is transparent, 1 is opaque).
valuenumberthe corresponding component value

reture

typedescription
void

code example