Version: 2017.3

Canvas.additionalShaderChannels

切换到手册
public AdditionalCanvasShaderChannels additionalShaderChannels ;

描述

获取或设置要在创建 Canvas 网格时使用的附加着色器通道的遮罩。

在为覆盖 Canvas 生成网格时,Canvas 将始终包括 Position、Color 和 Uv0 着色器通道,对于 ScreenSpace.Camera 和世界空间 Canvas,还将包括 Normal 和 Tangent。这些是要复制的可选附加参数。

using UnityEngine;

public class SetCanvasShaderChannels : MonoBehaviour { public Canvas canvas;

void Start() { canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.Normal; canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1; canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.Tangent; } }