Skip to content

Format

typescript
Material.GetVector(name)

class: Material

Description

Get the Vector value of a material based on the property name.

This method allows you to retrieve the value of a specific vector property of a material. It is important to ensure that the property name passed in is correct, otherwise it will return the default value.

Parameters

param_nametypedescription
namestringThe name of the property.

Return

typedescription
Vector4|undefinedWhether the Vector value is retrieved successfully and the retrieved Vector value.

Code Example

typescript
let material = Resources.Load<Material>(Material, "materialId");
let _Vec = material.GetVector("_Vec");
Debug.Log("_Vec : ",_Vec)