Note: Unity Remote Config is now available as a preview package. Remote Config is an improved offering that allows you to change the behavior and appearance of your game without requiring a new binary. You can remotely enable or disable features, change the specifics of your game to target specific audiences, or run special events by scheduling new content releases.
在 Unity Analytics Dashboard 中创建 Remote Settings 键/值对时,Unity Analytics 服务会将该设置存储在您为项目指定的 Configuration__(__Release 或 Development__)中。每当玩家启动应用程序的新会话时,Unity 都会提出网络请求以从 Analytics 服务获取最新配置。在玩家启动应用程序或者返回到已进入后台至少 30 分钟的应用程序时,Unity 会认为启动了新会话。在运行应用程序的常规非开发版时,Unity 会请求 Release__ 配置,而在运行开发版时请求 Development 配置。Unity Editor 中的 Play 模式被视为开发版。
注意:为了让 Unity 请求 Development 配置,必须使用 Unity 5.6.0p4+、5.6.1p1+、2017.1+ 或 Unity 5.5.3p4+ 来构建应用程序,并在 Build Settings 窗口中勾选 Development Build 复选框。如果使用较低版本的 Unity 来构建游戏,则 Unity 始终请求 Release 配置。
有关 Remote Settings 配置的网络请求完成时,RemoteSettings 对象会将一个 Updated
事件分发给任何已注册的事件处理程序,包括由 Remote Settings 组件注册的事件处理程序。
如果计算机或设备没有互联网连接而无法与 Analytics 服务通信,Unity 将使用自己上次收到并保存的配置。在使用保存的配置时,RemoteSettings
对象仍然会分发 Updated
事件。但是,如果 Unity 尚未保存任何设置(例如玩家第一次运行游戏时没有网络连接),则 RemoteSettings
对象不会分发 Updated
事件,因此不会更新游戏变量。通过网络请求 Remote Settings 配置是一个异步过程,在初始场景完成加载之前可能无法完成,或者根本无法完成,因此您应该始终将游戏变量初始化为合理的默认值。
注意:Unity 下载 Remote Settings 配置时使用的 Web 服务是只读的,但未受保护。这意味着配置可能被第三方读取。您不应将敏感或机密信息放入 Remote Settings。同样,保存的设置文件可能由终端用户读取和修改(尽管在下次启动具有可用互联网连接的会话时会覆盖任何修改)。
2017–05–30 页面已发布
截至 2017–05–30,服务与 Unity 5.5 之后的版本兼容,但是版本兼容性可能会发生变化。
2017.1 中的新功能
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.