private void CalculateValue() { if (!Application.isPlaying) { return; } if (cycleType == AC_CycleType.Language) { if (Application.isPlaying) { optionsArray = KickStarter.runtimeLanguages.Languages; } else { optionsArray = AdvGame.GetReferences().speechManager.languages; } if (Options.optionsData != null) { selected = Options.optionsData.language; if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages && splitLanguageType == SplitLanguageType.VoiceOnly) { selected = Options.optionsData.voiceLanguage; } } } else if (cycleType == AC_CycleType.Variable) { if (varID >= 0) { if (GlobalVariables.GetVariable(varID) == null || GlobalVariables.GetVariable(varID).type != VariableType.Integer) { ACDebug.LogWarning("Cannot link MenuToggle " + title + " to Variable " + varID + " as it is not an Integer."); } else if (optionsArray.Count > 0) { selected = Mathf.Clamp(GlobalVariables.GetIntegerValue(varID), 0, optionsArray.Count - 1); } else { selected = 0; } } } }