Format
typescript
Material.GetColor(name)class: Material
Description
Get the Color value of the current material based on the property name.
This method allows you to retrieve the value of a specific color property of the material. It is important to ensure that the property name provided is correct, otherwise it will return the default value.
Parameters
| param_name | type | description |
|---|---|---|
| name | string | The name of the property. |
Return
| type | description |
|---|---|
Color|undefined | Whether the Color value is retrieved successfully and the retrieved Color value. |
Code Example
typescript
let material = Resources.Load<Material>(Material, "materialId");
let _Color = material.GetColor("_Color");
Debug.Log("_Color : ",_Color);