Skip to content

Format

typescript
Material.SetMatrix4x4(name, value)

class: Material

Description

Set the value of the Matrix4x4 property in the current material shader.

This method assigns the specified matrix value to the property of the material, such as the world coordinate transformation matrix, projection matrix, etc. Typically, this method is used to modify the matrix-related properties in the material, such as the transformation matrix to control the position, rotation, and scaling of objects.

Parameters

param_nametypedescription
namestringThe name of the property.
valueMatrix4x4The Matrix4x4 value.

Return

typedescription
void

Code Example

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