Version: 2022.3

ShaderUtil.UpdateShaderAsset

切换到手册
public static void UpdateShaderAsset (AssetImporters.AssetImportContext context, Shader shader, string source, bool compileInitialShaderVariants);
public static void UpdateShaderAsset (Shader shader, string source, bool compileInitialShaderVariants);
public static void UpdateShaderAsset (Shader shader, string source);

参数

context A context object that the asset system needs to register shader dependencies properly.
source 一个字符串,包含在 ShaderLab 代码中编写的着色器。
compileInitialShaderVariants 设置为 true 可编译包含在源字符串中的 ShaderLab 代码;否则为 false。
shader 要更新的 Shader

描述

Replaces the existing source code in the specified shader with the source code in the supplied string.