LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

This version of Unity is unsupported.

CanvasRenderer.SetMaterial

Switch to Manual
public void SetMaterial(Material material, int index);
public void SetMaterial(Material material, Texture texture);

Parameters

materialMaterial for rendering.
textureMaterial texture overide.
indexMaterial index.

Description

Set the material for the canvas renderer. If a texture is specified then it will be used as the 'MainTex' instead of the material's 'MainTex'. See Also: CanvasRenderer.SetMaterialCount, CanvasRenderer.SetTexture.