void Update() { foreach (GameObject coin in coins) { CoinScript actualCoin = coin.GetComponent <CoinScript>(); if (actualCoin != null && !actualCoin.IsAlive()) { Vector3 newLoc = RandomLocation(radius); Debug.Log("reviving at " + newLoc); actualCoin.revive(newLoc, GlobalVars.numDimensions); } else if (actualCoin == null) { Debug.Log("couldn't find any coins to revive"); } if (actualCoin.dimension != GlobalVars.currentDimensionIter) { coin.SetActive(false); } else { coin.SetActive(true); } } }