ドキュメント

Unity Engine

Unity Engine

SetGlobalColor

Sets a global color property for all shaders.
読み終わるまでの所要時間 2 分最終更新 1ヶ月前

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

name

The name of the property.

value

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, this function doesn't do color space conversion. It is just an alias to Shader.SetGlobalVector.

SetGlobalColor(int, Color)

Sets a global color property for all shaders.
public static void SetGlobalColor(int nameID, Color value)

Parameters

nameID

The name ID of the property retrieved by Shader.PropertyToID.

value

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, this function doesn't do color space conversion. It is just an alias to Shader.SetGlobalVector.