private void Update() { // Workaround so that CheckVarsUpdate() is invoked on Unity's main thread. // This is called by Unity on every frame. if (VarCache.VarsNeedUpdate && developerModeEnabled && Leanplum.HasStarted) { VarCache.CheckVarsUpdate(); } // Run deferred actions. List <Action> actions = null; lock (delayed) { if (delayed.Count > 0) { actions = new List <Action>(delayed); delayed.Clear(); } } if (actions != null) { foreach (Action action in actions) { action(); } } }
/// <summary> /// Forces content to update from the server. If variables have changed, the /// appropriate callbacks will fire. Use sparingly as if the app is updated, /// you'll have to deal with potentially inconsistent state or user experience. /// The provided callback will always fire regardless /// of whether the variables have changed. /// </summary> /// public override void ForceContentUpdate(Action callback) { VarCache.CheckVarsUpdate(callback); }