Material Extensions

Set Color

This sets the color of the specified material.

Material material = new Material(Shader.Find("Standard"));

material.SetColor(Color.red);

Set Main Texture

This sets the main texture of the specified material.

Material material = new Material(Shader.Find("Standard"));

material.SetMainTexture(texture);

Set Texture Offset

This sets the main texture offset with the given value.

Material material = new Material(Shader.Find("Standard"));

material.SetTextureOffset(0.5f, 0.5f);

Set Texture Scale

This sets the main texture scale with the given value.

Set Shader

This sets the shader of the specified material.

Set Rendering Mode

This sets the shader of the specified material.

Lighten Color

This lightens the specified color by a given amount.

Darken Color

This darkens the specified color by a given amount.

Mix Colors

This mixes two colors based on the specified amount.

Invert Color

This inverts a color and returns.

Grayscale Color

This converts the specified color to its grayscale equivalent.

Set Alpha

This sets the alpha (transparency) value of the specified color.

Last updated