用于所有渲染的着色器脚本。
大多数高级渲染是通过 Material 类控制的。着色器类主要
用于检查着色器是否能够在用户的硬件(isSupported 属性)上运行,从而设置
全局着色器属性和关键字,以及按名称(Find 方法)查找着色器。
另请参阅:Material 类、Materials、ShaderLab documentation。
globalMaximumLOD | 所有着色器的着色器细节级别。 |
globalRenderPipeline | 当前正在使用的渲染管线。 |
isSupported | 该着色器能否在最终用户显卡上运行?(只读) |
maximumLOD | 此着色器的着色器细节级别。 |
passCount | 返回活动 SubShader 上的着色器通道数。 |
renderQueue | 此着色器的渲染队列。(只读) |
FindPassTagValue | 在着色器的活动 SubShader 中搜索由 tagName 指定的通道标签,并返回该标签的值。 |
FindPropertyIndex | 按名称查找着色器属性的索引。 |
GetDependency | 返回依赖关系着色器。 |
GetPropertyAttributes | 返回一个字符串数组,其中包含位于指定索引处的着色器属性的特性。 |
GetPropertyCount | 返回此着色器中的属性数。 |
GetPropertyDefaultFloatValue | 返回指定索引处的着色器属性的默认浮点值。 |
GetPropertyDefaultVectorValue | 返回指定索引处的着色器属性的默认 Vector4 值。 |
GetPropertyDescription | 返回指定索引处的着色器属性的描述字符串。 |
GetPropertyFlags | 返回指定索引处的着色器属性的 ShaderPropertyFlags。 |
GetPropertyName | 返回指定索引处的着色器属性的名称。 |
GetPropertyNameId | 返回指定索引处的着色器属性的 nameId。 |
GetPropertyRangeLimits | 返回指定索引处的 Range 属性的下限和上限。 |
GetPropertyTextureDefaultName | 返回指定索引处的 Texture 着色器属性的默认纹理名称。 |
GetPropertyTextureDimension | 返回指定索引处的 Texture 着色器属性的 TextureDimension。 |
GetPropertyType | 返回指定索引处的属性的 ShaderPropertyType。 |
DisableKeyword | 取消设置全局着色器关键字。 |
EnableKeyword | 设置全局着色器关键字。 |
Find | 查找具有给定 name 的着色器。 |
GetGlobalColor | 获取先前用 SetGlobalColor 为所有着色器设置的全局颜色属性。 |
GetGlobalFloat | 获取先前用 SetGlobalFloat 为所有着色器设置的全局浮点属性。 |
GetGlobalFloatArray | 获取先前用 SetGlobalFloatArray 为所有着色器设置的全局浮点数组。 |
GetGlobalInt | 获取先前用 SetGlobalInt 为所有着色器设置的全局整数属性。 |
GetGlobalMatrix | 获取先前用 SetGlobalMatrix 为所有着色器设置的全局矩阵属性。 |
GetGlobalMatrixArray | 获取先前用 SetGlobalMatrixArray 为所有着色器设置的全局矩阵数组。 |
GetGlobalTexture | 获取先前用 SetGlobalTexture 为所有着色器设置的全局纹理属性。 |
GetGlobalVector | 获取先前用 SetGlobalVector 为所有着色器设置的全局向量属性。 |
GetGlobalVectorArray | 获取先前用 SetGlobalVectorArray 为所有着色器设置的全局向量数组。 |
IsKeywordEnabled | 是否启用了全局着色器关键字? |
PropertyToID | 获取着色器属性名称的唯一标识符。 |
SetGlobalBuffer | 为所有着色器设置全局计算缓冲区属性。 |
SetGlobalColor | 为所有着色器设置全局颜色属性。 |
SetGlobalConstantBuffer | 将 ComputeBuffer 设置为材质的指定常量缓冲区。 |
SetGlobalFloat | 为所有着色器设置全局浮点属性。 |
SetGlobalFloatArray | 为所有着色器设置全局浮点数组属性。 |
SetGlobalInt | 为所有着色器设置全局整数属性。 |
SetGlobalMatrix | 为所有着色器设置全局矩阵属性。 |
SetGlobalMatrixArray | 为所有着色器设置全局矩阵数组属性。 |
SetGlobalTexture | 为所有着色器设置全局纹理属性。 |
SetGlobalVector | 为所有着色器设置全局向量属性。 |
SetGlobalVectorArray | 为所有着色器设置全局向量数组属性。 |
WarmupAllShaders | 完全加载所有着色器,以防未来性能中断。 |
GetInstanceID | 返回对象的实例 ID。 |
ToString | 返回对象的名称。 |
Destroy | 移除 GameObject、组件或资源。 |
DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 |
DontDestroyOnLoad | 在加载新的 Scene 时,请勿销毁 Object。 |
FindObjectOfType | 返回第一个类型为 type 的已加载的激活对象。 |
FindObjectsOfType | 返回所有类型为 type 的已加载的激活对象的列表。 |
Instantiate | 克隆 original 对象并返回克隆对象。 |
bool | 该对象是否存在? |
operator != | 比较两个对象是否引用不同的对象。 |
operator == | 比较两个对象引用,判断它们是否引用同一个对象。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.