SetGlobalColor
Sets a global color property for all shaders.
Read time 2 minutesLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
SetGlobalColor(string, Color)
Sets a global color property for all shaders.
public static void SetGlobalColor(string name, Color value)
Parameters
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 block).
PropertiesUsually 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, this function doesn't do color space conversion. It is just an alias to Shader.SetGlobalVector.
Additional Resources: Shader.SetGlobalFloat, Shader.SetGlobalVector, Shader.SetGlobalTexture; Material class, ShaderLab documentation.
SetGlobalColor(int, Color)
Sets a global color property for all shaders.
public static void SetGlobalColor(int nameID, Color value)
Parameters
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 block).
PropertiesUsually 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, this function doesn't do color space conversion. It is just an alias to Shader.SetGlobalVector.
Additional Resources: Shader.SetGlobalFloat, Shader.SetGlobalVector, Shader.SetGlobalTexture; Material class, ShaderLab documentation.