# GetVector

> Get a named vector value.

## Definition

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

## GetVector(string)

Get a named vector value.

```csharp
public Vector4 GetVector(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Vector4](/engine/6000.6/script-reference/unityengine/vector4.md) |             |

### Remarks

Four component vectors and colors are the same in Unity shaders. `GetVector` does exactly the same as [Material.GetColor](/engine/6000.6/script-reference/unityengine/material/getcolor.md) just the input data type is different (`xyzw` in the vector becomes `rgba` in the color). The only difference is that color values are converted from sRGB to Linear value, when using linear color space (see [properties in shader programs](/engine/6000.6/manual/materials-and-shaders/shaders/writing-custom/shader-writing/writing-shader-change-properties/sl-properties-in-programs.md)).

Additional Resources: [Material.GetColor](/engine/6000.6/script-reference/unityengine/material/getcolor.md), [Material.SetVector](/engine/6000.6/script-reference/unityengine/material/setvector.md), [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).

## GetVector(int)

Get a named vector value.

```csharp
public Vector4 GetVector(int nameID)
```

### 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).

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Vector4](/engine/6000.6/script-reference/unityengine/vector4.md) |             |

### Remarks

Four component vectors and colors are the same in Unity shaders. `GetVector` does exactly the same as [Material.GetColor](/engine/6000.6/script-reference/unityengine/material/getcolor.md) just the input data type is different (`xyzw` in the vector becomes `rgba` in the color). The only difference is that color values are converted from sRGB to Linear value, when using linear color space (see [properties in shader programs](/engine/6000.6/manual/materials-and-shaders/shaders/writing-custom/shader-writing/writing-shader-change-properties/sl-properties-in-programs.md)).

Additional Resources: [Material.GetColor](/engine/6000.6/script-reference/unityengine/material/getcolor.md), [Material.SetVector](/engine/6000.6/script-reference/unityengine/material/setvector.md), [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).
