# SetGlobalColor

> Sets a global color property for all shaders.

## Definition

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

## SetGlobalColor(string, Color)

Sets a global color property for all shaders.

```csharp
public static void SetGlobalColor(string name, Color value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[Color]\(/engine/6000.6/script-reference/unityengine/color)):&#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" color (for example, color of the sun). Then you can set the global property from script and don't have to setup the same color in all materials.

Note that unlike [Material.SetColor](/engine/6000.6/script-reference/unityengine/material/setcolor.md), this function doesn't do color space conversion. It is just an alias to [Shader.SetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/setglobalvector.md).

Additional Resources: [Shader.SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md), [Shader.SetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/setglobalvector.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).

## SetGlobalColor(int, Color)

Sets a global color property for all shaders.

```csharp
public static void SetGlobalColor(int nameID, Color 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).**** (\[Color]\(/engine/6000.6/script-reference/unityengine/color)):&#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" color (for example, color of the sun). Then you can set the global property from script and don't have to setup the same color in all materials.

Note that unlike [Material.SetColor](/engine/6000.6/script-reference/unityengine/material/setcolor.md), this function doesn't do color space conversion. It is just an alias to [Shader.SetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/setglobalvector.md).

Additional Resources: [Shader.SetGlobalFloat](/engine/6000.6/script-reference/unityengine/shader/setglobalfloat.md), [Shader.SetGlobalVector](/engine/6000.6/script-reference/unityengine/shader/setglobalvector.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).
