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

  1. Open the Lion Settings window and select GrowthBook from the left panel.

  2. Ensure that Enable Initialization is checked.

  3. Three-Letter Game Code: If you do not have one, please request it from your studio manager.

  4. Client Key: If you do not have a client key, please request it from your studio manager.

Growthbook Settings
GrowthBook Settings - Lion Settings Window

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.

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?