Unity Remote Settings

A few weeks ago, the new Unity Remote Settings Beta was announced.  The system is designed to allow developers to modify game settings without pushing an update.  This can be used for anything from toggling a live event, unlocking new content, tuning game balance,  switching on new features, or any other change that doesn’t need new code or assets.  Prior to the Remote Settings system, you’d need to setup your own service somewhere and write your own code to call into it (or find a good 3rd party solution).  Now, it’s being built in and pretty easy to use.

Getting Started with Unity Remote Settings

The Unity Remote settings asset is available on the asset store.

Import the package to a new project.

Open the Services Tab

Enable Unity Analytics

If you don’t have a project ID setup, you’ll need to do that now with the Create option.

The Dashboard

In the Analytics area, click the “Go to Dashboard” button.

This should open your web browser to the Unity Analytics dashboard.

Creating a Setting

To create a new setting, you just need to choose a name, a type, and a value.

Create one named “cubesToSpawn

Set it to an Integer (int).

Set the value to “4“.

Click add.

Syncing Settings

After you add or change a setting, you’ll need to Sync it.

Click the Sync button.

Back to Unity

Now that we’ve created a setting and synced it, we’ll need to pull it into our project.

Remote Settings GameObject

For the settings to work, we need a GameObject with the RemoteSettings script attached to it.

Create an empty GameObject.

Name it “[RemoteSettings]“.

Add the RemoteSettings component to it.

Something to Sync

It’s time to start pulling in our variable.  There are two ways you can do this..  either by assigning a parameter in the Remote Settings inspector or by code.

Personally, I prefer the code method, so I’ll show that here.

Create a new Script.

Name it “CubeSpawner

Replace the contents with this.

Create a new GameObject.

Name it CubeSpawner.

Add the CubeSpawner component  to it.

Press Play and watch your cubes spawn.

Changing the Value

These settings wouldn’t be useful if you couldn’t modify them.

Go back to the Dashboard and change the cubesToSpawn value to something else.

Click Sync – VERY IMPORTANT, THEY WON’T UPDATE IF YOU DON’T DO THIS.

Stop and re-start your game in the editor then watch the number of cubes change.

Conclusions

The new Remote Settings system seems pretty useful.  I’ve done similar things where I needed to setup my own services for this kind of functionality.. and plenty of others have done the same.

Now, we have a pretty simple and standardized method for changing variables in our games or apps without doing an update.

Next time you need to have some adjustable settings, try out the Remote Settings asset.

Note: Also, when you want to go live, make sure to put your settings under the “Release” option.  We used “Development” here.. but that won’t work in a release build.