void OnEnable() { text.text = placeholder; variable = CFG.GetVar(varName); if (variable == null) { StartCoroutine(getvar()); } else { variable.OnChangedBase += Sync; } }
IEnumerator getvar() { while (true) { variable = CFG.GetVar(varName); if (variable != null) { break; } yield return(null); } variable.OnChangedBase += Sync; yield break; }
// Use this for initialization void Start() { _slider = GetComponent <Slider>(); variable = CFG.GetVar(varName); floatvar = (CFG.Variable <float>)variable; }