BoolUI InstatiateBoolUI(string key) { GameObject prefab = Instantiate(boolPrefab, boolsUI.content); var newBool = new BoolUI() { key = key, parent = prefab, input = prefab.GetComponentInChildren <InputField>(), toggle = prefab.GetComponentInChildren <Toggle>(), removeButton = prefab.GetComponentInChildren <Button>(), }; newBool.input.text = newBool.key; newBool.toggle.isOn = LocalPrefs.Get(newBool.key, false); return(newBool); }
void DestroyBool(BoolUI boolUI) { LocalPrefs.RemoveKey <bool>(boolUI.key); Destroy(boolUI.parent); bools.Remove(boolUI); }