Feature Flags
The GrowthBook SDK is our internal feature flag system. It lets us remotely enable, disable, and configure features without shipping a new build.
Setup
Open the Lion Settings window and select GrowthBook from the left panel.
Ensure that Enable Initialization is checked.
Three-Letter Game Code: If you do not have one, please request it from your studio manager.
Client Key: If you do not have a client key, please request it from your studio manager.

Getting Started
Get Feature
Use the GetFeature async function to fetch a feature flag by key.
var feature = await FeatureFlagController.GetFeature("example_key", false);This returns a single feature from the local dictionary.
If the value is already cached, it returns immediately unless you set force to true.
Returns null if the service has not initialized successfully or if the key does not exist.
Callback
Subscribe to OnFeatureFlagsUpdated to be notified when feature flags are loaded or refreshed.
This callback may fire twice on startup: once when cached values are available, and again after the latest values are fetched from the server.
FeatureFlagController.OnFeatureFlagsUpdated += FeatureFlagUpdated;The callback provides the full set of feature flags in a dictionary, so you can look up keys as needed.
private static void FeatureFlagUpdated(FeatureFlagData data, bool isLocal)
{
data.Features.TryGetValue("feature_flag_key", out var settings)
}isLocal will be true if its from the cache and false if its from the server
Feature Flag Class
This class represents the data stored for a single feature flag. It contains two primary fields:
ExperimentInfo
Populated automatically by GrowthBook. We use this with Lion Analytics to track experiments without additional instrumentation.
IsInExperiment (bool): true if the player is assigned to an experiment bucket
ExperimentName (string): The experiment name the player is in
VariantName (string): The variant the player has been assigned
RawString
The raw string value returned from the server. You can parse this into their own data model as needed.
Attributes
The GrowthBook SDK uses the WhoAmI service to automatically collect basic user attributes. These attributes are sent to our server so each player can be evaluated and bucketed immediately.
You can use attributes to segment players into specific groups:
Id: Unique player identifier (used for sticky bucketing)
Country: Player’s current country
Version: Installed game version
Campaign: Acquisition campaign the player installed from
Platform: iOS or Android
Check out the example here.
Last updated
Was this helpful?