Skip to content

Format

typescript
Material.SetColor(name, value)

class: Material

Description

Set the Color value of a material based on the property name.

This method assigns the specified color value to the material's property.

Parameters

param_nametypedescription
namestringThe name of the property.
valueColorThe Color value.

Return

typedescription
void

Code Example

typescript
let material = Resources.Load<Material>(Material, "materialId");
material.SetColor("_Color",Color.red);
let _Color = material.GetColor("_Color");
Debug.Log("_Color : ",_Color)