Syncing at Runtime
Sync
Sync() downloads the latest configuration from the server and immediately applies it to the local cache. It is a coroutine — use yield return to wait for it to complete:
private IEnumerator SyncOnStart(){ var configurations = playOpsSDK.Configurations(); configurations.Initialize();
yield return configurations.Sync();
// Configuration is now up-to-date var shopConfig = configurations.GetConfiguration<ShopConfig>(); Debug.Log($"Shop has {shopConfig.Products.Count} products.");}Download without applying
Download() fetches the latest configuration from the server but does not update the active cache. The downloaded data is delivered via the OnConfigurationDownloaded event. Subscribe to it and call Update() with the received data when you are ready to apply — for example, between levels to avoid mid-gameplay changes:
configurations.OnConfigurationDownloaded += rawConfig =>{ // Store and apply later (e.g. between levels) configurations.Update(rawConfig);};yield return configurations.Download();Manually applying a configuration
Update(Hashtable) applies raw configuration data directly:
// Apply a Hashtable of configuration data (e.g. from a test fixture)configurations.Update(rawConfiguration);Calling Update() without an argument is a no-op — you must pass the hashtable.
Full recommended pattern
public class SessionBootstrap : MonoBehaviour{ void Start() { StartCoroutine(Boot()); }
private IEnumerator Boot() { var configurations = playOpsSDK.Configurations(); configurations.Initialize();
// Show loading screen LoadingScreen.Show();
yield return configurations.Sync();
// Configuration is fresh — safe to read values ApplyConfiguration(configurations);
LoadingScreen.Hide(); }
private void ApplyConfiguration(PlayOpsConfigurations configurations) { var shopConfig = configurations.GetConfiguration<ShopConfig>(); ShopController.Instance.SetProducts(shopConfig.Products);
var iapConfig = configurations.GetConfiguration<IAPConfig>(); IAPManager.Instance.SetProducts(iapConfig.InAppProducts); }}Network failure handling
Sync() does not throw if the server is unreachable. When the network request fails, the coroutine completes normally and the local configuration (bundled default or previously downloaded) remains active. Your game continues to function with the last known-good values.