public void LoadPocketsFromPrefs() { for (int i = 0; i < currencies.Count; i++) { if (currencies[i] == null) { continue; } Pocket tempPocket = currencyPockets[currencies[i]]; Pocket newPocket; try { newPocket = SaveAndLoad.LoadFromPrefs <Pocket>(currencies[i].name); } catch (Exception e) { Debug.LogError(e.Message); newPocket = tempPocket; } if (newPocket != null) { currencyPockets[currencies[i]] = newPocket; onValueChange.Invoke(currencies[i], newPocket.Value); } } }