# SetGlobalVector

> Sets a global vector property for all shaders.

## Definition

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

## SetGlobalVector(string, Vector4)

Sets a global vector property for all shaders.

```csharp
public static void SetGlobalVector(string name, Vector4 value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[Vector4]\(/engine/6000.6/script-reference/unityengine/vector4)):&#x20;

### Remarks

Global properties are used if a shader needs them but the material does not have them defined (for example, if the shader does not expose them in `Properties` block).

Usually this is used if you have a set of custom shaders that all use the same "global" vector (for example, wind direction). Then you can set the global property from script and don't have to setup the same vector in all materials.

Additional Resources: [Shader.SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md), [Shader.SetGlobalColor](/engine/6000.6/script-reference/unityengine/shader/setglobalcolor.md), [Shader.SetGlobalTexture](/engine/6000.6/script-reference/unityengine/shader/setglobaltexture.md); [Material](/engine/6000.6/script-reference/unityengine/material.md) class, [ShaderLab documentation](/engine/6000.6/script-reference/unityengine/shaders.md).

## SetGlobalVector(int, Vector4)

Sets a global vector property for all shaders.

```csharp
public static void SetGlobalVector(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.6/script-reference/unityengine/shader/propertytoid.md).**** (\[Vector4]\(/engine/6000.6/script-reference/unityengine/vector4)):&#x20;

### Remarks

Global properties are used if a shader needs them but the material does not have them defined (for example, if the shader does not expose them in `Properties` block).

Usually this is used if you have a set of custom shaders that all use the same "global" vector (for example, wind direction). Then you can set the global property from script and don't have to setup the same vector in all materials.

Additional Resources: [Shader.SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md), [Shader.SetGlobalColor](/engine/6000.6/script-reference/unityengine/shader/setglobalcolor.md), [Shader.SetGlobalTexture](/engine/6000.6/script-reference/unityengine/shader/setglobaltexture.md); [Material](/engine/6000.6/script-reference/unityengine/material.md) class, [ShaderLab documentation](/engine/6000.6/script-reference/unityengine/shaders.md).
