文档

​
​

Development

User Acquisition

Monetization

工业

Analytics

Unity SDK

Client API

Analytics

此页面不支持所选语言。
LiveOps
​
​
Analytics
  • Overview
  • Get started
  • Pricing
  • Concepts
  • Tutorials
    • Create a custom event
    • Record an event
    • Record events with a custom user ID
    • Record transaction events
    • Record ad impression events
    • Copy custom events to another environment
    • Create a custom dashboard
    • Edit a custom dashboard
    • Create a funnel
    • Track user acquisition
    • Create a custom audience
    • Run a query with SQL Data Explorer
    • Query parameter values with SQL Data Explorer
    • Optimize SQL Data Explorer queries
    • Set up Data Access
    • Record an event with the REST API
    • Generate a unique user ID with the REST API
    • Request data deletion with the REST API
    • Debug event reporting
    • SDK 5.0.0 migration
    • Migrate to Unity 6.2 with Analytics SDK 6.1.0
    • Request game data deletion
  • Reference
  • Privacy and consent
  • FAQ
  1. Unity Analytics

Migrate to Unity 6.2 with Analytics SDK 6.1.0

Update your consent management code to use the Developer Data framework in Unity 6.2 with Analytics Software Development Kit 6.1.0.
阅读时间2 分钟
最后更新于 8 个月前

Follow this guide if you're upgrading to Unity 6.2 with Analytics SDK 6.1.0.
Unity 6.2 introduces the Developer Data framework to manage player consent. This framework uses the Unity Engine's
EndUserConsent
API, replacing the SDK's
StartDataCollection()
and
StopDataCollection()
methods. This guide details these changes and how to adapt your project.
注意
If you are using SDK version 6.1.0 or later in an earlier version of Unity where the Developer Data framework is not present, the old methods are still present. This guide only applies to using the latest SDK versions in the latest Unity Editor versions.
You no longer need to manually activate the Analytics SDK after calling
UnityServices.InitializeAsync()
. To use the new Developer Data framework, you must remove all usages of the
StartDataCollection()
and
StopDataCollection()
methods.
Instead, use the
EndUserConsent.SetUserConsent(...)
method to grant consent for
AnalyticsIntent
. You only need to do this once. The Developer Data framework stores this consent status locally, and the Analytics SDK activates automatically based on this stored value.
The following code demonstrates how to record player consent for data collection:
// ... ask for consent...ConsentState consentState = EndUserConsent.GetConsentState();if (userGaveConsent){ consentState.AnalyticsIntent = ConsentStatus.Granted;}else{ consentState.AnalyticsIntent = ConsentStatus.Denied;}EndUserConsent.SetConsentState(consentState);
To learn more about managing consent with the
EndUserConsent
API, refer to the Developer Data framework documentation.
If
UnityServices.InitializeAsync()
has already been called, setting
AnalyticsIntent
to
Granted
immediately starts data collection. If you set
AnalyticsIntent
to
Granted
first, data collection starts during
UnityServices.InitializeAsync()
instead.
If the
AnalyticsIntent
status is set to any value other than
Granted
, at any time, data collection stops immediately or does not start during initialization.

Request data deletion

The Analytics SDK still controls data deletion requests, using the existing
RequestDataDeletion()
method. However, the SDK no longer automatically stops collecting data when doing so. In order to make a data deletion request, you must deny consent using the
EndUserConsent
API first.
ConsentState consentState = EndUserConsent.GetConsentState();consentState.AnalyticsIntent = ConsentStatus.Denied;EndUserConsent.SetConsentState(consentState);AnalyticsService.Instance.RequestDataDeletion();

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • Request data deletion


报告此页面的问题