用于所有渲染的着色器脚本。
大多数高级渲染是通过 Material 类控制的。着色器类主要
用于检查着色器是否能够在用户的硬件(isSupported 属性)上运行,从而设置
全局着色器属性和关键字,以及按名称(Find 方法)查找着色器。
另请参阅:Material 类、Materials、ShaderLab documentation。
enabledGlobalKeywords | An array containing the global shader keywords that are currently enabled. |
globalKeywords | An array containing the global shader keywords that currently exist. This includes enabled and disabled global shader keywords. |
globalMaximumLOD | 所有着色器的着色器细节级别。 |
globalRenderPipeline | 当前正在使用的渲染管线。 |
maximumChunksOverride | Sets the limit on the number of shader variant chunks Unity loads and keeps in memory. |
isSupported | 该着色器能否在最终用户显卡上运行?(只读) |
keywordSpace | The local keyword space of this shader. |
maximumLOD | 此着色器的着色器细节级别。 |
passCount | 返回活动 SubShader 上的着色器通道数。 |
renderQueue | 此着色器的渲染队列。(只读) |
subshaderCount | Returns the number of SubShaders in this shader. |
FindPassTagValue | Searches for the tag specified by tagName on the shader's active SubShader and returns the value of the tag. |
FindPropertyIndex | 按名称查找着色器属性的索引。 |
FindSubshaderTagValue | Searches for the tag specified by tagName on the SubShader specified by subshaderIndex and returns the value of the tag. |
FindTextureStack | Find the name of a texture stack a texture belongs too. |
GetDependency | 返回依赖关系着色器。 |
GetPassCountInSubshader | Returns the number of passes in the given SubShader. |
GetPropertyAttributes | 返回一个字符串数组,其中包含位于指定索引处的着色器属性的特性。 |
GetPropertyCount | 返回此着色器中的属性数。 |
GetPropertyDefaultFloatValue | 返回指定索引处的着色器属性的默认浮点值。 |
GetPropertyDefaultIntValue | Returns the default int value of the shader property at the specified index. |
GetPropertyDefaultVectorValue | 返回指定索引处的着色器属性的默认 Vector4 值。 |
GetPropertyDescription | 返回指定索引处的着色器属性的描述字符串。 |
GetPropertyFlags | 返回指定索引处的着色器属性的 ShaderPropertyFlags。 |
GetPropertyName | 返回指定索引处的着色器属性的名称。 |
GetPropertyNameId | 返回指定索引处的着色器属性的 nameId。 |
GetPropertyRangeLimits | 返回指定索引处的 Range 属性的下限和上限。 |
GetPropertyTextureDefaultName | 返回指定索引处的 Texture 着色器属性的默认纹理名称。 |
GetPropertyTextureDimension | 返回指定索引处的 Texture 着色器属性的 TextureDimension。 |
GetPropertyType | 返回指定索引处的属性的 ShaderPropertyType。 |
DisableKeyword | Disables a global shader keyword. |
EnableKeyword | Enables a global shader keyword. |
Find | 查找具有给定 name 的着色器。 |
GetGlobalColor | 获取先前用 SetGlobalColor 为所有着色器设置的全局颜色属性。 |
GetGlobalFloat | 获取先前用 SetGlobalFloat 为所有着色器设置的全局浮点属性。 |
GetGlobalFloatArray | 获取先前用 SetGlobalFloatArray 为所有着色器设置的全局浮点数组。 |
GetGlobalInt | This method is deprecated. Use GetGlobalFloat or GetGlobalInteger instead. |
GetGlobalInteger | Gets a global integer property for all shaders previously set using SetGlobalInteger. |
GetGlobalMatrix | 获取先前用 SetGlobalMatrix 为所有着色器设置的全局矩阵属性。 |
GetGlobalMatrixArray | 获取先前用 SetGlobalMatrixArray 为所有着色器设置的全局矩阵数组。 |
GetGlobalTexture | 获取先前用 SetGlobalTexture 为所有着色器设置的全局纹理属性。 |
GetGlobalVector | 获取先前用 SetGlobalVector 为所有着色器设置的全局向量属性。 |
GetGlobalVectorArray | 获取先前用 SetGlobalVectorArray 为所有着色器设置的全局向量数组。 |
IsKeywordEnabled | Checks whether a global shader keyword is enabled. |
PropertyToID | 获取着色器属性名称的唯一标识符。 |
SetGlobalBuffer | Sets a global buffer property for all shaders. |
SetGlobalColor | 为所有着色器设置全局颜色属性。 |
SetGlobalConstantBuffer | Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for all shader types. |
SetGlobalFloat | 为所有着色器设置全局浮点属性。 |
SetGlobalFloatArray | 为所有着色器设置全局浮点数组属性。 |
SetGlobalInt | This method is deprecated. Use SetGlobalFloat or SetGlobalInteger instead. |
SetGlobalInteger | Sets a global integer property for all shaders. |
SetGlobalMatrix | 为所有着色器设置全局矩阵属性。 |
SetGlobalMatrixArray | 为所有着色器设置全局矩阵数组属性。 |
SetGlobalTexture | 为所有着色器设置全局纹理属性。 |
SetGlobalVector | 为所有着色器设置全局向量属性。 |
SetGlobalVectorArray | 为所有着色器设置全局向量数组属性。 |
SetKeyword | Sets the state of a global shader keyword. |
WarmupAllShaders | Prewarms all shader variants of all Shaders currently in memory. |
GetInstanceID | Gets the instance ID of the object. |
ToString | 返回对象的名称。 |
Destroy | 移除 GameObject、组件或资源。 |
DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 |
DontDestroyOnLoad | 在加载新的 Scene 时,请勿销毁 Object。 |
FindObjectOfType | 返回第一个类型为 type 的已加载的激活对象。 |
FindObjectsOfType | Gets a list of all loaded objects of Type 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.