版本:Unity 6 (6000.0)
语言:English
在脚本中获取标签值
计算着色器

包需求定义故障排除

如果您定义了永远无法满足的包需求,则着色器在 GPU 上运行的程序。 更多信息
参见 术语表
导入过程将失败并出现错误。本节提供了一些最常见的无效包需求定义示例。

格式错误的版本或空包名称

PackageRequirements {
  "com.some.package.x": "[10.2.1,9.0]"        // Error, empty version range
  "com.some.package.y": "[10.2.1.9,11.0]"     // Error, incorrect version format
  "com.some.package.z": "[2.3,3.5],[3.0,4.0]" // Error, ranges intersect
  "com.some.package.z" : "[10.2.1,11.0]"      // Error, extra whitespace after the package name
  "" : "[2.3.4,3.4.5]"                        // Error, no package name provided
}

对同一包的多个依赖项

PackageRequirements {
  "com.some.package.x": "[10.2.1,11.0]"
  "com.some.package.x": "[11.2.1,12.0]" // Error, dependency on "com.some.package.x" declared twice
  "unity" : "2021.2"
  "unity" : "2021.3" // Error, dependency on Unity version declared twice
}

冲突的依赖项声明

PackageRequirements {
  "com.some.package.x": "unity=[2021.2.1,2021.3.3]"
  "unity" : "2021.2"    // Error: Unity version requirement cannot be declared on a package and on its own simultaneously
}

子着色器和通道之间的冲突依赖项声明

SubShader {
  PackageRequirements {
    "com.some.package.x": "[2.3.4,3.4.5]"
    "com.some.package.z": "[1.1,3.2]"
    "unity": "2021.2"
  }
  Pass {
    PackageRequirements {
      "com.some.package.y": "[1.2.2,2.5]"               // Fine, SubShader doesn’t declare a dependency on "com.some.package.y"
      "com.some.package.z": "[2.0,3.1]"                 // Fine, SubShader dependency intersects the provided version range
      "com.some.package.x": "[1.1.1, 2.2.2]"            // Error, SubShader version range for "com.some.package.x" does not intersect the provided range
      "com.some.package.w": "unity=[2021.2.1,2021.2.5]" // Fine, SubShader dependency intersects the provided version range
      "com.some.package.u": "unity=[2020.2.1,2020.2.5]" // Error, SubShader Unity version range does not intersect the provided range
    }
  }
}

其他资源

在脚本中获取标签值
计算着色器