I have a lot of mario style coins in each level of my game, and I need a way save when they have been taken by the player. So when you go back to that level later they are gone. There are dozens in each level, so giving them a unique name and saving a PlayerPref string for each is not something I want to do manually.
for (i = 0; i < CoinList.Count; i++)
{
for (j = 0; j < TotalCoins.Count; i++)
{
if (CoinList*.coin.name == TotalCoins[j])*
{ //1 for True PlayerPrefs.SetInt(TotalCoins[j].name, 1); } else { //Set 0 for False since this coin has not been picked up if (i == TotalCoins.Count - 1) PlayerPrefs.SetInt(TotalCoins[j].name, 0); } } } } OnCoinsLoad () { for (i = 0; i < ListOfCoinsInPlayerPrefs; i++) { if (ListOfCoinsInPlayerPrefs*.value == 1)* //Load Coins else //Dont load Coins } }