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

# XGameRuntimeInit

> XGameRuntimeInit

# XGameRuntimeInit

XGameRuntimeInit API 的参考资料。

## Functions

| Function                                                                                          | Description           |
| ------------------------------------------------------------------------------------------------- | --------------------- |
| [XGameRuntimeInitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize)     | 初始化 Gaming Runtime。   |
| [XGameRuntimeUninitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeuninitialize) | 取消初始化 Gaming Runtime。 |

## Error Codes

XGameRuntime API 可能返回以下错误代码。有关完整列表，请参阅[错误代码](/reference/errorcodes)。

| Code                                         | Value      | Description                              |
| -------------------------------------------- | ---------- | ---------------------------------------- |
| E\_GAMERUNTIME\_NOT\_INITIALIZED             | 0x89240100 | 游戏运行时未初始化。                               |
| E\_GAMERUNTIME\_DLL\_NOT\_FOUND              | 0x89240101 | 找不到游戏运行时 DLL。                            |
| E\_GAMERUNTIME\_VERSION\_MISMATCH            | 0x89240102 | 游戏运行时 DLL 不支持此版本的 GDK。                   |
| E\_GAMERUNTIME\_WINDOW\_NOT\_FOREGROUND      | 0x89240103 | 该操作要求应用程序窗口位于前台。                         |
| E\_GAMERUNTIME\_SUSPENDED                    | 0x89240104 | 游戏运行时处于挂起状态。                             |
| E\_GAMERUNTIME\_UNINITIALIZE\_ACTIVEOBJECTS  | 0x89240105 | 在 XGameRuntimeUninitialize 时游戏运行时存在活动对象。 |
| E\_GAMERUNTIME\_MULTIPLAYER\_NOT\_CONFIGURED | 0x89240106 | 未在此标题上为此用户在服务上设置任何多人游戏活动。                |
| E\_GAMERUNTIME\_OPTIONS\_MISMATCH            | 0x89240109 | 运行时已使用不同的选项集初始化。请在使用新选项重新初始化之前取消初始化。     |
| E\_GAMERUNTIME\_OPTIONS\_NOT\_SUPPORTED      | 0x8924010A | 传递的选项与游戏的包不兼容。游戏配置信息必须与包匹配。              |
| E\_GAMERUNTIME\_GAMECONFIG\_BAD\_FORMAT      | 0x8924010B | 传递给 Initialize 的游戏配置无法解析。                |
| E\_GAMERUNTIME\_INVALID\_HANDLE              | 0x8924010C | 句柄在跨运行时初始化时不能有效使用。                       |

## Conceptual documentation

* [在 Unity 项目中为 GDK API 使用 C# 包装器](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/get-started-with-unity-pc/features/gdk-unity-api-wrappers)

## See also

[系统 API 参考](/reference/system/gc-reference-system-toc)


## Related topics

- [XGameRuntimeInitialize](/zh-CN/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize.md)
- [XGameRuntimeInitializeWithOptions](/zh-CN/reference/system/xgameruntimeinit/functions/xgameruntimeinitializewithoptions.md)
- [XGameRuntimeUninitialize](/zh-CN/reference/system/xgameruntimeinit/functions/xgameruntimeuninitialize.md)
- [XGameRuntimeOptions](/zh-CN/reference/system/xgameruntimeinit/Structures/xgameruntimeoptions.md)
- [XGameRuntimeGameConfigSource](/zh-CN/reference/system/xgameruntimeinit/Enumerations/xgameruntimegameconfigsource.md)
