可帮助从编辑器与着色器配合使用的 Utility 函数。
allowAsyncCompilation | 为 true 时,允许在当前调用站点中使用异步着色器编译。 |
anythingCompiling | 为 true 时,编译器在查询时异步编译一些着色器。 |
hardwareSupportsRectRenderTexture | 当前硬件是否支持渲染纹理。 |
ClearCachedData | 清除为给定着色器生成的所有内部缓存数据(如错误和编译信息)。 |
ClearShaderMessages | 清除给定着色器的编译时间消息。 |
CompilePass | 请求编辑器编译给定材质的特定通道所需的着色器变体。 |
CreateShaderAsset | Creates a new Shader object from the provided source code string. You can use this method alongside the ScriptedImporter to create custom shader generation tools in the Editor. |
GetAllShaderInfo | 返回所有可用着色器的 ShaderInfo 数组,包括内置着色器。 |
GetCallableShaderCount | 返回给定 RayTracingShader 中定义的可调用着色器数。 |
GetCallableShaderName | 返回给定 RayTracingShader 中用户定义的可调用着色器的名称。 |
GetCallableShaderParamSize | 返回给定 RayTracingShader 中用户定义的可调用着色器的参数大小。 |
GetComputeShaderMessageCount | 返回 Unity 着色器编译器为给定 ComputeShader 生成的错误和警告数。 |
GetComputeShaderMessages | 返回 Unity 着色器编译器为给定 ComputeShader 生成的每个错误和警告。 |
GetCurrentCustomEditor | Gets the current custom editor for the shader you pass in.Depending on the render pipeline asset assigned in your Graphics Settings, the custom editor can change if the shader has a different custom editor for one or multiple render pipeline assets. |
GetCustomEditorForRenderPipeline | Gets the shader's custom editor class name for a specific render pipeline asset type. |
GetMissShaderCount | 返回给定 RayTracingShader 中定义的未命中着色器数。 |
GetMissShaderName | 返回给定 RayTracingShader 中用户定义的未命中着色器的名称。 |
GetMissShaderRayPayloadSize | 返回给定 RayTracingShader 中用户定义的未命中着色器的光线有效负载大小。 |
GetPassKeywords | Gets the local shader keywords that are valid for a Pass within a particular shader. |
GetPropertyCount | 获取着色器中的属性数量。 |
GetPropertyDescription | 获取着色器的 propertyIdx 索引处的着色器属性的描述。 |
GetPropertyName | 获取着色器的 propertyIdx 索引处的着色器属性的名称。 |
GetPropertyType | 获取着色器的 propertyIdx 索引处的着色器属性的 ShaderProperyType。 |
GetRangeLimits | 获取着色器的 propertyIdx 索引处的范围属性的限制。 |
GetRayGenerationShaderCount | 返回给定 RayTracingShader 中定义的光线生成着色器数。 |
GetRayGenerationShaderName | 返回给定 RayTracingShader 中用户定义的光线生成着色器的名称。 |
GetRayTracingShaderMessageCount | 返回着色器编译器为给定 RayTracingShader 生成的错误和警告数。 |
GetRayTracingShaderMessages | 返回着色器编译器为给定 RayTracingShader 生成的每个错误和警告。 |
GetShaderData | 获取特定着色器的着色器数据。 |
GetShaderInfo | Gets ShaderInfo for the given shader. |
GetShaderMessageCount | 返回 Unity 着色器编译器为给定 Shader 生成的错误和警告数。 |
GetShaderMessages | 返回 Unity 着色器编译器为给定 Shader 生成的每个错误和警告。 |
GetShaderPlatformKeywordsForBuildTarget | Gets the platform keywords for a shader, given a shader compiler platform, build target, and optional graphics tier. These platform keywords are necessary to properly compile a shader for a given target. |
GetTexDim | 获取着色器属性的纹理尺寸。 |
HasProceduralInstancing | Determines whether the specified Shader contains a valid Procedural Instancing variant. |
IsPassCompiled | 检查材质中给定通道的着色器变体是否已编译。 |
IsShaderPropertyHidden | 着色器的 propertyIdx 索引处的着色器属性是否隐藏? |
IsShaderPropertyNonModifiableTexureProperty | 着色器的 propertyIdx 索引处的着色器属性是否为 NonModifiableTextureProperty? |
PassHasKeyword | Checks whether a local shader keyword is valid for a Pass within a particular shader. |
RegisterShader | 注册用户创建的着色器。 |
RestoreAsyncCompilation | 在此 CommandBuffer 范围中恢复以前的着色器编译模式。 |
SetAsyncCompilation | 在 CommandBuffer 中添加着色器编译模式命令。 |
ShaderHasError | Checks if a shader has any compilation errors. Ignores warnings. |
ShaderHasWarnings | Checks if a shader has any compilation warnings. Ignores errors. |
UpdateShaderAsset | Replaces the existing source code in the specified shader with the source code in the supplied string. |
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.