> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Intelligent Delivery：OnDemand 內容

> Intelligent Delivery：OnDemand 內容

> [!NOTE]
>
> 不再建議使用 OnDemand 屬性。您應該考慮改用功能和配方，將內容分組成可獨立新增和移除的群組。功能和配方仍可讓您指定預設要安裝的內容，就像 OnDemand 屬性一樣。

OnDemand 區塊可讓遊戲指定預設不安裝、但可在使用者要求時或遊戲呼叫 [XPackageInstallChunks](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackageinstallchunks.md) 方法時安裝的內容。

若要將區塊指定為 OnDemand，請將 `OnDemand` 屬性套用至 layout.xml 檔案中的區塊，如下列範例所示。

```xml theme={null}
<Chunk Id="6000" Tags="LevelEditor" OnDemand="true">  
```

包含 `OnDemand` 屬性的區塊也必須包含自訂標籤規範，讓執行階段 API 可以依標籤參照相關聯的區塊。

遊戲可以呼叫 [XPackageUninstallChunks](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackageuninstallchunks.md) 方法來解除安裝 OnDemand 內容。

## 參考 API 文件

* [XPackage (API 內容)](https://docs.xbox.com/zh-TW/reference/system/xpackage/xpackage_members.md)
  * 函式
    * [XPackageInstallChunks](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackageinstallchunks.md)
    * [XPackageUninstallChunks](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackageuninstallchunks.md)

## 另請參閱

[Intelligent Delivery](https://docs.xbox.com/zh-TW/build/core-features/common/packaging/overviews/intelligentdelivery.md)


## Related topics

- [Intelligent Delivery](https://docs.xbox.com/zh-TW/build/core-features/common/packaging/overviews/intelligentdelivery.md)
- [XPackageInstallChunks](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackageinstallchunks.md)
- [XPackageUninstallChunks](https://docs.xbox.com/zh-TW/reference/system/xpackage/functions/xpackageuninstallchunks.md)
- [Intelligent Delivery：自訂標記指定元](https://docs.xbox.com/zh-TW/build/core-features/common/packaging/intelligentdelivery-custom.md)
- [Intelligent Delivery：裝置規範](https://docs.xbox.com/zh-TW/build/core-features/common/packaging/intelligentdelivery-device.md)
