Version: 2022.1

ShaderUtil.CreateShaderAsset

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

参数

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

描述

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.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961