Skip to content

Format

typescript
Material.GetMatrix4x4(name)

class: Material

Description

Get the value of a Matrix4x4 property from the current shader used by the material.

This method allows you to retrieve the value of a specific matrix property from 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
Matrix4x4|undefinedWhether the Matrix4x4 value is successfully retrieved.The retrieved Matrix4x4 value.

Code Example

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