Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


UpdateShaderAsset

Replaces the existing source code in the specified shader with the source code in the supplied string.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

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.