Unity
hive_config.xml 文件已创建,文件中的项目已配置。在 Hive SDK Unity 中,有两种方法可以创建和配置 hive_config.xml 文件。
- 使用 Unity Hive Config Editor 自动生成和配置文件
- 手动创建和配置文件
Unity hive 配置编辑器设置¶
在Unity环境中,您可以自动创建hive_config.xml文件,并使用Unity Hive 配置编辑器分配配置值。
设置操作系统和认证版本¶
选择 Hive > Hive 配置 (编辑配置) 并在 编辑器 屏幕上设置必要的值。首先,检查 操作系统 和 Hive 应用程序 ID。然后,要使用 Google 认证,请选择操作系统并在 Auth 菜单下的 Google SignIn 项中设置值。
Google 登录设置¶
要使用常规的 Google 身份验证,请根据以下信息在 Auth 菜单中输入 Google SignIn 项目的所需值。
- 在 Google 应用 ID 字段中输入您收到的 AppID。
- 在 Google 服务器客户端 ID 字段中输入您收到的 Web 应用程序的客户端 ID 值。
Hive配置设置¶
您可以在hive_config.xml 文件中配置的值中设置以下值。
<
项目 | 操作系统 | 描述 | 必需 | SDK 默认值 |
---|---|---|---|---|
appId | Android, iOS, Windows | 游戏构建标识符。 | X |
|
zone | Android, iOS, Windows | Hive 客户端将连接的服务器。
| X | `real` |
useLog | Android, iOS, Windows | 是否启用 Hive 客户端内部操作的日志记录。当启用日志记录时,日志将输出到开发工具屏幕。
| X | `false` |
ageGateU13 | Android, iOS, Windows | COPPA ageGateU13 应用状态。要将 COPPA ageGateU13 应用到 Hive SDK,您必须在 Hive 控制台中注册 COPPA 条款,并在初始化 Hive SDK 之前将此值设置为 true 。如果您不希望应用 COPPA ageGateU13,您必须在 Hive 控制台中注册其他条款,并在初始化 Hive SDK 之前将此值设置为 false 。
| X | `false` |
hiveOrientation | Android, iOS, Windows | Hive SDK 的 UI 将根据设备方向设置进行显示。
| X | 'undefined' |
channel | Android, iOS, Windows | 游戏应用中用于登录和应用内支持服务的平台。如果您通过 Hive SDK 登录外部社交媒体或使用应用内购买,则对应于 C2S。用于从 Hive SDK 收集分析数据。
| O | `C2S` |
market | Android,iOS,Windows | 这是用于处理应用内购买的市场。它用于Hive SDK分析收集。
| O | 空值 |
agreementDetermineBase | Android,iOS | 确定获取条款协议的标准。您可以选择`device`或`account`,默认值为`device`。
| X | `device` |
unsupportedUAShareType | Android | 这是一个特定于Android的设置,用于配置在使用促销用户获取(UA)共享功能时不会显示图标的共享应用。配置的目标将在UI中不显示其图标。
| X | 空值 |
httpConnectTimeout | Android,iOS,Windows | 这是Hive客户端内部使用的HTTP连接的超时时间(以秒为单位)。
| X | `8`(单位:秒) |
httpReadTimeout | Android,iOS,Windows | 这是Hive客户端内部使用的HTTP读取的超时时间(以秒为单位)。
| X | `8`(单位:秒) |
hive_config.xml 文件创建¶
检查员 完成设置后,按照以下步骤创建hive_config.xml文件。
- Android: 点击保存并重新生成设置文件按钮以生成AndroidManifest.xml文件和hive_config.xml文件。hive_config.xml文件将创建在以下目录中。
- Unity 2021及以上版本:
/Assets/HiveSDK/hive.androidlib/src/main/res/raw - Unity 2021以下版本:
/Assets/Plugins/Android/res/raw/
- Unity 2021及以上版本:
- iOS: 点击保存并重新生成设置文件按钮以生成Info.plist文件和hive_config.xml文件。hive_config.xml文件将创建在以下目录中。
/Assets/Plugins/iOS/<
hive_config.xml 示例¶
以下是使用身份验证(Google 身份验证)和支付(Google Play 商店或 Apple AppStore)时的 hive_config.xml 文件示例。请根据您希望使用的 Hive SDK 功能和应用环境修改、添加或删除值。由于 iOS 仅支持 Apple AppStore 支付,请在 Unity iOS 环境中将市场设置为 AP
。
<properties>
<!-- Hive SDK Common Settings: START -->
<!-- Set unique game build identifier -->
<appId>com.sample.your</appId>
<!-- Select Hive platform server. sandbox for development, real for production
(sandbox, real) -->
<zone>real</zone>
<!-- Set whether to use SDK internal operation logs
(true, false) -->
<useLog>false</useLog>
<!-- Set whether to apply ageGateU13
(true, false) -->
<ageGateU13>false</ageGateU13>
<!-- Hive Orientation setting -->
<hiveOrientation>landscape</hiveOrientation>
<!-- Channel setting (login and in-app support service platform)
(C2S: Hive platform) -->
<channel>C2S</channel>
<!-- Payment market setting
(GO: Google Play, LE: Com2us Lebi, AP: Apple App Store) -->
<market>GO</market>
<!-- Set criteria for receiving agreement to terms
(device, account) -->
<agreementDetermineBase>false</agreementDetermineBase>
<!-- Set HTTP Connect Timeout used internally by Hive SDK in seconds
(Do not change unless in special cases) -->
<httpConnectTimeout>8</httpConnectTimeout>
<!-- Set HTTP Read Timeout used internally by Hive SDK in seconds
(Do not change unless in special cases) -->
<httpReadTimeout>8</httpReadTimeout>
<!-- Hive SDK Common Settings: END -->
<!-- Hive SDK Feature Settings: START -->
<!-- Authentication feature setting: Use Google authentication -->
<providers>
<google playAppId="123456789012" clientId="123456789012-abc.apps.googleusercontent.com" serverClientId="123456789012-abc.apps.googleusercontent.com" reversedClientId="com.googleusercontent.apps.123456789012-abc" deviceFlowClientId="331526026701-gn1abq1ev23nqj7rdvvlaamf7ii4f3u9.apps.googleusercontent.com" />
</providers>
<!-- Hive SDK Feature Settings: END -->
</properties>
Info
Hive SDK 配置可以在应用构建之前将值存储在配置文件中,或在运行时(应用执行期间)更改配置值。有关更多详细信息,请查看 Hive SDK 配置。