Version: 2021.1
언어: 한국어
public Type type ;

설명

Each time an object of a specific type is indexed, the registered function is called.

[CustomObjectIndexer(typeof(Shader), version = 1)]
internal static void ShaderIndexing(CustomObjectIndexerTarget context, ObjectIndexer indexer)
{
    if (!(context.target is Shader shader) || !indexer.settings.options.properties)
        return;

    for (int i = 0, end = shader.GetPropertyCount(); i != end; ++i)
    {
        var name = shader.GetPropertyName(i).ToLowerInvariant();
        if (name.Length > 0 && name[0] == '_')
            name = name.Substring(1);
        switch (shader.GetPropertyType(i))
        {
            case UnityEngine.Rendering.ShaderPropertyType.Color:
                var v = shader.GetPropertyDefaultVectorValue(i);
                IndexColor(name, new Color(v.x, v.y, v.z, v.w), indexer, context.documentIndex);
                break;
            case UnityEngine.Rendering.ShaderPropertyType.Vector:
                v = shader.GetPropertyDefaultVectorValue(i);
                IndexVector(name, v, indexer, context.documentIndex);
                break;
            case UnityEngine.Rendering.ShaderPropertyType.Float:
                indexer.IndexNumber(context.documentIndex, name, shader.GetPropertyDefaultFloatValue(i));
                break;
        }
    }
}
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961