public void SpawnAttacker() { Debug.Log("ToDo: money value here"); if (buildingSystem.money < attackUnitCost) { Debug.Log("need more money"); } else { buildingSystem.TakeMoney(attackUnitCost); Vector3 offsetForSpawning = new Vector3(Random.Range(-offsetSpawn, offsetSpawn), 0, 0); Instantiate(attackUnit, spawnPoint.transform.position + offsetForSpawning, Quaternion.identity); } }