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.
읽는 시간 1분최근 업데이트: 7달 전
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 API, replacing the SDK's and methods. This guide details these changes and how to adapt your project.
EndUserConsentStartDataCollection()StopDataCollection()You no longer need to manually activate the Analytics SDK after calling . To use the new Developer Data framework, you must remove all usages of the and methods.
UnityServices.InitializeAsync()StartDataCollection()StopDataCollection()Instead, use the method to grant consent for . 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.
EndUserConsent.SetUserConsent(...)AnalyticsIntentThe 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 API, refer to the Developer Data framework documentation.
EndUserConsentIf has already been called, setting to immediately starts data collection. If you set to first, data collection starts during instead.
UnityServices.InitializeAsync()AnalyticsIntentGrantedAnalyticsIntentGrantedUnityServices.InitializeAsync()If the status is set to any value other than , at any time, data collection stops immediately or does not start during initialization.
AnalyticsIntentGrantedRequest data deletion
The Analytics SDK still controls data deletion requests, using the existing 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 API first.
RequestDataDeletion()EndUserConsentConsentState consentState = EndUserConsent.GetConsentState();consentState.AnalyticsIntent = ConsentStatus.Denied;EndUserConsent.SetConsentState(consentState);AnalyticsService.Instance.RequestDataDeletion();