Skip to content

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_nametypedescription
namestringThe name of the property.

Return

typedescription
Color|undefinedWhether 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);