コード例 #1
0
        public static object GetSGPropertyValue(AbstractShaderProperty property)
        {
            switch (property.propertyType)
            {
            case PropertyType.Texture2D:
                return(((Texture2DShaderProperty)property).value.texture);

            case PropertyType.Texture3D:
                return(((Texture3DShaderProperty)property).value.texture);

            case PropertyType.Cubemap:
                return(((CubemapShaderProperty)property).value.cubemap);

            case PropertyType.Texture2DArray:
                return(((Texture2DArrayShaderProperty)property).value.textureArray);

            default:
            {
                var          type = GetSGPropertyType(property);
                PropertyInfo info = property.GetType().GetProperty("value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
                return(VFXConverter.ConvertTo(info?.GetValue(property), type));
            }
            }
        }