void PlacingCoins() { for (int i = 0; i < n; i++) { //COIN SPAWNING POSITIONS coinx = Random.Range(-5, 5); if (coinx <= -1.3) { coiny = Random.Range(2, 5); } else if (coinx > -1.3f && coinx <= -1.1f) { coiny = Random.Range(1, 5); } else if (coinx > -1.1f && coinx <= 1.5f) { coiny = Random.Range(3, 5); } else if (coinx > 1.5f && coinx <= 3.4f) { coiny = Random.Range(4, 5); } else { coiny = Random.Range(4, 5); } GameObject newcoin = pool.Spawncoins(); newcoin.transform.position = new Vector3(transform.position.x + coinx, transform.position.y + coiny, transform.position.z); newcoin.transform.rotation = transform.rotation; newcoin.SetActive(true); } }