# SetMatrix

> Set a matrix property.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## SetMatrix(string, Matrix4x4)

Set a matrix property.

```csharp
public void SetMatrix(string name, Matrix4x4 value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[Matrix4x4]\(/engine/6000.6/script-reference/unityengine/matrix4x4)): The matrix value to set.

### Remarks

Adds a property to the block. If a matrix property with the given name already exists, the old value is replaced.

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetFloat](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setfloat.md), [MaterialPropertyBlock.SetTexture](/engine/6000.6/script-reference/unityengine/materialpropertyblock/settexture.md).

## SetMatrix(int, Matrix4x4)

Set a matrix property.

```csharp
public void SetMatrix(int nameID, Matrix4x4 value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).**** (\[Matrix4x4]\(/engine/6000.6/script-reference/unityengine/matrix4x4)): The matrix value to set.

### Remarks

Adds a property to the block. If a matrix property with the given name already exists, the old value is replaced.

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetFloat](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setfloat.md), [MaterialPropertyBlock.SetTexture](/engine/6000.6/script-reference/unityengine/materialpropertyblock/settexture.md).
