hz-unity-platform-sdk

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Horizon Platform SDK - Unity/C# Integration Guide

Horizon Platform SDK - Unity/C# 集成指南

When to Use

使用场景

Use this skill when a developer:
  • Wants to integrate any Horizon Platform SDK feature in a Unity Meta Quest application
  • Asks about setup, initialization, or dependencies for the Unity SDK package (
    com.meta.xr.sdk.platform
    )
  • Needs help with a specific public platform API (achievements, IAP, users, etc.) in C#
  • Is troubleshooting errors or status codes from any SDK package in Unity
  • Asks about
    Core.AsyncInitialize
    ,
    Oculus.Platform
    , or platform message handling
For Android/Kotlin apps, use the
hz-platform-sdk
skill instead.
当开发者遇到以下情况时,可使用本技能:
  • 希望在Unity开发的Meta Quest应用中集成Horizon Platform SDK的任意功能
  • 咨询Unity SDK包(
    com.meta.xr.sdk.platform
    )的设置、初始化或依赖配置问题
  • 需要在C#中使用特定的公开平台API(成就系统、IAP、用户系统等)的相关帮助
  • 排查Unity中任意SDK包产生的错误或状态码问题
  • 咨询
    Core.AsyncInitialize
    Oculus.Platform
    或平台消息处理相关问题
对于Android/Kotlin应用,请改用
hz-platform-sdk
技能。

Quick Start

快速开始

Available APIs

可用API

FeatureReferenceDescription
Abuse Report
abuse-report
Listen for system Report button events, respond with in-app flow
Achievements
achievements
Unlock, track progress, and query simple/count/bitfield achievements
Application
application
Get app version, launch other apps, manage self-update downloads
Application Lifecycle
application-lifecycle
Detect launch type, handle deeplinks and invites, log results
Asset File
asset-file
List, download, cancel, and delete downloadable asset files (DLC)
Challenges
challenges
Time-bound score competitions on top of leaderboards
Consent
consent
Check and launch user consent flows with version bumps
Device Application Integrity
device-application-integrity
Verify device and app integrity via JWT attestation
Entitlements
entitlements
Mandatory anti-piracy check required for all Store apps
Group Presence
group-presence
Set/clear presence, manage sessions, send invites, handle join intents
In-App Purchases (IAP)
iap
Retrieve products, purchase history, checkout flow, consume purchases
Language Pack
language-pack
Get/set language packs with auto-download
Leaderboards
leaderboards
Retrieve leaderboard info, fetch/write entries with filtering
Notifications
notifications
Send device notifications with toast, feed persistence, and action buttons
Rate and Review
rate-and-review
Check eligibility and launch the system rating/review UI
Rich Presence
rich-presence
Set/clear rich presence (deprecated; prefer group-presence)
User Age Category
user-age-category
Query user age group and report age categories for compliance
Users
users
Retrieve user profiles, friends, access tokens, identity verification
功能参考标识描述
举报功能
abuse-report
监听系统举报按钮事件,响应用内举报流程
成就系统
achievements
解锁、跟踪进度并查询简单型/计数型/位字段型成就
应用管理
application
获取应用版本、启动其他应用、管理自动更新下载
应用生命周期
application-lifecycle
检测启动类型、处理深度链接与邀请、记录结果
资源文件
asset-file
列出、下载、取消及删除可下载资源文件(DLC)
挑战系统
challenges
基于排行榜的限时分数竞赛功能
用户同意管理
consent
检查并启动用户同意流程,支持版本更新
设备应用完整性
device-application-integrity
通过JWT验证设备与应用完整性
授权验证
entitlements
所有商店应用必需的反盗版检查机制
群组状态
group-presence
设置/清除状态、管理会话、发送邀请、处理加入请求
应用内购买(IAP)
iap
获取产品信息、购买历史、结账流程、消费已购项目
语言包
language-pack
获取/设置语言包,支持自动下载
排行榜
leaderboards
获取排行榜信息、筛选读写榜单条目
通知功能
notifications
发送设备通知,支持弹窗、信息流持久化及操作按钮
评分与评价
rate-and-review
检查资格并启动系统评分/评价界面
富状态显示
rich-presence
设置/清除富状态(已弃用;推荐使用group-presence)
用户年龄分类
user-age-category
查询用户年龄组并上报年龄分类以符合合规要求
用户系统
users
获取用户资料、好友列表、访问令牌、身份验证信息

How to Use

使用步骤

  1. First, read
    references/common-setup.md
    for shared setup instructions, initialization code, Editor testing, and common patterns that apply to all APIs.
  2. Then, read the specific reference file for the API you need (e.g.,
    references/iap.md
    for in-app purchases).
Each reference file contains only the package-specific content: API operations, data types, examples, and package-specific notes. The common setup, initialization patterns, and coding conventions are centralized in
common-setup.md
to avoid duplication.
  1. 首先,阅读
    references/common-setup.md
    获取通用设置说明、初始化代码、编辑器测试方法及适用于所有API的通用模式。
  2. 然后,阅读对应API的具体参考文件(例如,如需应用内购买功能,请阅读
    references/iap.md
    )。
每个参考文件仅包含该包的专属内容:API操作、数据类型、示例及包专属注意事项。通用设置、初始化模式及编码规范集中在
common-setup.md
中,避免内容重复。