private void CalculateValue() { if (!Application.isPlaying) { return; } if (cycleType == AC_CycleType.Language) { optionsArray = KickStarter.speechManager.languages; if (KickStarter.options.optionsData != null) { selected = KickStarter.options.optionsData.language; } } else if (cycleType == AC_CycleType.Variable) { if (varID >= 0) { if (RuntimeVariables.GetVariable(varID) == null || RuntimeVariables.GetVariable(varID).type != VariableType.Integer) { Debug.LogWarning("Cannot link MenuToggle " + title + " to Variable " + varID + " as it is not an Integer."); } else if (optionsArray.Count > 0) { selected = Mathf.Clamp(RuntimeVariables.GetIntegerValue(varID), 0, optionsArray.Count - 1); } else { selected = 0; } } } }