# SetVector

> Set a vector property.

## Definition

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

## SetVector(string, Vector4)

Set a vector property.

```csharp
public void SetVector(string name, Vector4 value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[Vector4]\(/engine/6000.0/script-reference/unityengine/vector4)): The [Vector4](/engine/6000.0/script-reference/unityengine/vector4.md) value to set.

### Remarks

Adds a property to the block. If a vector property with the given name already exists, the old value is replaced. If the property is previously added using [MaterialPropertyBlock.SetColor](/engine/6000.0/script-reference/unityengine/materialpropertyblock/setcolor.md), the value is automatically converted to active color space as if ::SetColor is called.

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

## SetVector(int, Vector4)

Set a vector property.

```csharp
public void SetVector(int nameID, Vector4 value)
```

### Parameters

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

### Remarks

Adds a property to the block. If a vector property with the given name already exists, the old value is replaced. If the property is previously added using [MaterialPropertyBlock.SetColor](/engine/6000.0/script-reference/unityengine/materialpropertyblock/setcolor.md), the value is automatically converted to active color space as if ::SetColor is called.

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