At the start of a new session of your application, Unity makes a network request for the latest remote settings configuration from the Analytics Service. Unity requests the Release configuration when running regular, non-development builds of your application, and requests the Development configuration when running development builds. Play mode in the Unity Editor counts as a development build.
Note: For Unity to request the Development configuration, you must build the application with Unity version 5.6.0p4+, 5.6.1p1+, 2017.1+, or Unity 5.5.3p4+, and tick the Development Build checkbox on the Build Settings window. If you build the game with an older version of Unity, Unity always requests the Release configuration.
The RemoteSettings
object dispatches a BeforeFetchFromServer:: event before it makes the network request for settings.
The Remote Settings
object then dispatches an Updated event if a configuration file is available. Note that if the network request fails and a remote configuration file is not available, the RemoteSettings
object checks whether a local, cached configuration file is present. If so, it uses these cached values and still dispatches Updated. Updated is only not dispatched when the remote request fails and no cached version is present.
Whether or not the remote request succeeds, the RemoteSettings
object dispatches the Completed event. The parameters passed to the Completed
event provide the HTTP response code and whether a remote configuration file was received.
When the RemoteSettings
object receives a remote configuration it caches the file for use when the current computer or device is offline. However, if your game instance has not saved the settings yet (such as when a player has no network connection the first time they run your game), then the RemoteSettings object does not dispatch an Updated event, and so does not update your game variables. Requesting the Remote Settings configuration over the network is an asynchronous process that might not complete before your initial Scene has finished loading, or might not complete successfully at all, so you should always initialize your game variables to reasonable defaults.
Note: The web service from which Unity downloads the Remote Settings configuration is read-only, but is not secured. This means that the configuration could be read by third-parties. You should not put sensitive or secret information into your Remote Settings. Similarly, the saved settings file could be read and modified by end-users (although any modifications are overwritten the next time a session starts with an available Internet connection).
Create remote settings as key-value pairs on your Analytics dashboard.
You can only store basic types in the Remote Settings (int, float,
string and boolean).
Additional resources: Remote Settings (Manual).