DataPrivacy
类根据玩家的数据隐私管理选项来配置 Unity Analytics 服务。
NAMESPACE: UnityEngine.Analytics
public class DataPrivacy
DataPrivacy
类自动获取玩家的数据隐私状态,并相应配置 Analytics 服务。
使用 FetchPrivacyUrl()
函数来获取玩家个人数据管理页面的 URL。打开该 URL 即可为玩家提供管理其数据隐私设置的选项。
本页详细介绍以下函数:
准备 Data Privacy API 以供使用。
public static void Initialize()
此函数会创建一个隐藏的游戏对象,并会将 DataPrivacy
类的实例作为组件添加到该游戏对象。
在 Unity 5.1 或更早版本中,应在应用程序启动时尽早调用 Initialize()
(理想情况下是在调用 UnityAnalytics.StartSDK (projectId)
之后立即进行)。更高版本的 Unity 会自动调用 Initialize()
。
获取玩家个人数据管理页面的 URL。
public static void FetchPrivacyUrl(Action<string> success, Action<string> failure = null)
Action<String> success
— 成功获取该 URL 时要调用的 Action 对象。传递给 Action 的字符串包含该 URL。
[optional] Action<String> failure
— Unity 无法获取该 URL 时要调用的 Action 对象。传递给 Action 的字符串包含失败原因。
应在浏览器或 Web 视图中打开传递给 success
函数的 URL,让玩家有机会管理他们的数据保护选项。您可以使用 Application.OpenURL()
打开该页面。
该 URL 在短时间内有效。务必在打开 URL 之前即时获取 URL。
2018–11–05 页面已发布
删除了用于插入 Data Privacy 按钮的 Editor 菜单命令。添加了 Data Privacy Button 预制件。
Unity 2018.1 中的新功能。
在 2018.3 版中删除了 FetchOptOutStatus 函数。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.