Get started with Remote Config on Unity

Select platform:iOS+AndroidWebFlutterUnityC++


You can useFirebase Remote Config to define parameters in your app andupdate their values in the cloud, allowing you to modify the appearance andbehavior of your app without distributing an app update.

TheRemote Config library is used to store in-app default parameter values,fetch updated parameter values from theRemote Config backend, and controlwhen fetched values are made available to your app. To learn more, seeRemoteConfig loading strategies.

This guide walks you through the steps to get started and provides some samplecode, all of which is available to clone or download from thefirebase/quickstart-unity GitHub repository.

Step 1: AddRemote Config to your app

Before you can useRemote Config,you need to:

  • Register your Unity project and configure it to use Firebase.

    • If your Unity project already uses Firebase, then it's alreadyregistered and configured for Firebase.

    • If you don't have a Unity project, you can download asample app.

  • Add theFirebaseUnity SDK (specifically,FirebaseRemoteConfig.unitypackage) toyour Unity project.

Find detailed instructions for these initial setup tasks inAdd Firebase to your Unity project.

Note that adding Firebase to your Unity project involves tasks both in theFirebase console and in your open Unity project(for example, you download Firebase config files from the console, then movethem into your Unity project).

Step 2: Set in-app default parameter values

You can set in-app default parameter values in theRemote Configobject, so that your app behaves as intended before it connects to theRemote Config backend, and so that default values are available if none areset in the backend.

Important: Don't store confidential data inRemote Config parameter keys orvalues.Remote Config data is encrypted in transit, but end users can accessany default or fetchedRemote Config parameter that is available to theirclient app instance.

To do this, create a string dictionary, and populate it with key-value pairsrepresenting the defaults you want to add. If you have already configuredRemote Config backend parameter values, you can download a file thatcontains these key-value pairs and use it to construct your string dictionary.For more information, seeDownloadRemote Config template defaults.

(Non-string properties will be converted to the property's type whenSetDefaultsAsync() is called).

System.Collections.Generic.Dictionary<string,object>defaults=newSystem.Collections.Generic.Dictionary<string,object>();// These are the values that are used if we haven't fetched data from the// server// yet, or if we ask for values that the server doesn't have:defaults.Add("config_test_string","default local string");defaults.Add("config_test_int",1);defaults.Add("config_test_float",1.0);defaults.Add("config_test_bool",false);Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.SetDefaultsAsync(defaults).ContinueWithOnMainThread(task=>{

Step 3: Get parameter values to use in your app

Now you can get parameter values from theRemote Config object. If you setvalues in theRemote Config backend, fetched them, and then activated them,those values are available to your app. Otherwise, you get the in-app parametervalues configured usingSetDefaultsAsync().

To get these values, useGetValue(),providing the parameter key as an argument. This returns aConfigValue,which has properties to convert the value into various base types.

Step 4: Set parameter values

  1. In theFirebase console, open your project.
  2. SelectRemote Config from the menu to view theRemote Configdashboard.
  3. Define parameters with the same names as the parameters that you defined inyour app. For each parameter, you can set a default value (which willeventually override the in-app default value) and conditional values. Tolearn more, seeRemote Config parameters and conditions.

Step 5: Fetch and activate values (as needed)

To fetch parameter values from theRemote Config backend, call theFetchAsync()method. Any values that you set on the backend are fetched and cached in theRemote Config object.

// Start a fetch request.// FetchAsync only fetches new data if the current data is older than the provided// timespan.  Otherwise it assumes the data is "recent enough", and does nothing.// By default the timespan is 12 hours, and for production apps, this is a good// number. For this example though, it's set to a timespan of zero, so that// changes in the console will always show up immediately.publicTaskFetchDataAsync(){DebugLog("Fetching data...");System.Threading.Tasks.TaskfetchTask=Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero);returnfetchTask.ContinueWithOnMainThread(FetchComplete);}

In the previous code,FetchComplete is a method whose signature matches theparameters of one of theoverloadsofContinueWithOnMainThread().

In the sample code that follows, theFetchComplete method is passed theprevious task (fetchTask), which allowsFetchComplete to determine whetherit finished. The code usesInfo.LastFetchStatusto then determine whether the finish wasalso successful. If so,Remote Config parameter values are then activated usingActivateAsync().

private void FetchComplete(Task fetchTask) {  if (!fetchTask.IsCompleted) {    Debug.LogError("Retrieval hasn't finished.");    return;  }  var remoteConfig = FirebaseRemoteConfig.DefaultInstance;  var info = remoteConfig.Info;  if(info.LastFetchStatus != LastFetchStatus.Success) {    Debug.LogError($"{nameof(FetchComplete)} was unsuccessful\n{nameof(info.LastFetchStatus)}: {info.LastFetchStatus}");    return;  }  // Fetch successful. Parameter values must be activated to use.  remoteConfig.ActivateAsync()    .ContinueWithOnMainThread(      task => {        Debug.Log($"Remote data loaded and ready for use. Last fetch time {info.FetchTime}.");    });}

Values fetched usingFetchAsync()are cached locally when the fetch completes, but are not made available untilActivateAsync()is invoked. This lets you ensure that the new values are not appliedmid-calculation, or at other times that might cause problems or strangebehavior.

Step 6: Listen for updates in real time

After you fetch parameter values, you can use real-timeRemote Config tolisten for updates from theRemote Config backend. Real-timeRemote Config signals to connected devices when updates are available andautomatically fetches the changes after you publish a newRemote Configversion.

Real-time updates are supported by theFirebaseUnity SDK v11.0.0+ and higher forAndroid and Apple platforms.

Important: Real-timeRemote Config also requires theFirebase Remote Config Realtime API, which should already be enabled for you. To verify, open theGoogle Cloud console, select your project, and open theAPIs and Services page. The API should appear as enabled. If it's missing or not enabled, clickEnable APIs & Services, search forFirebase Remote Config Realtime API, and then enable it.

  1. In your app, add anOnConfigUpdateListener to start listening for updatesand automatically fetch any new or updated parameter values. Then, create aConfigUpdateListenerEventHandler to process update events. The followingexample listens for updates and uses the newly fetched values to display anupdated welcome message.
// Invoke the listener.voidStart(){Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.OnConfigUpdateListener+=ConfigUpdateListenerEventHandler;}// Handle real-time Remote Config events.voidConfigUpdateListenerEventHandler(objectsender,Firebase.RemoteConfig.ConfigUpdateEventArgsargs){if(args.Error!=Firebase.RemoteConfig.RemoteConfigError.None){Debug.Log(String.Format("Error occurred while listening: {0}",args.Error));return;}Debug.Log("Updated keys: "+string.Join(", ",args.UpdatedKeys));// Activate all fetched values and then display a welcome message.remoteConfig.ActivateAsync().ContinueWithOnMainThread(task=>{DisplayWelcomeMessage();});}// Stop the listener.voidOnDestroy(){Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.OnConfigUpdateListener-=ConfigUpdateListenerEventHandler;}

The next time you publish a new version of yourRemote Config, devices thatare running your app and listening for changes will call the completion handler.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.