文档

Unity Engine

Unity Engine

UpdateShaderAsset

Replaces the existing source code in the specified shader with the source code in the supplied string.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

UpdateShaderAsset(AssetImportContext, Shader, string, bool)

Replaces the existing source code in the specified shader with the source code in the supplied string.
public static void UpdateShaderAsset(AssetImportContext context, Shader shader, string source, bool compileInitialShaderVariants)

Parameters

A context object that the asset system needs to register shader dependencies properly.

shader

The Shader to update.

source

A string that contains a shader written in ShaderLab code.

compileInitialShaderVariants

Set to true to compile the ShaderLab code contained in the source string; otherwise false.

UpdateShaderAsset(Shader, string)

Replaces the existing source code in the specified shader with the source code in the supplied string.
public static void UpdateShaderAsset(Shader shader, string source)

Parameters

shader

The Shader to update.

source

A string that contains a shader written in ShaderLab code.

UpdateShaderAsset(Shader, string, bool)

Replaces the existing source code in the specified shader with the source code in the supplied string.
public static void UpdateShaderAsset(Shader shader, string source, bool compileInitialShaderVariants)

Parameters

shader

The Shader to update.

source

A string that contains a shader written in ShaderLab code.

compileInitialShaderVariants

Set to true to compile the ShaderLab code contained in the source string; otherwise false.