private Enemy Spawn() { Vector3 pos = new Vector3( Random.Range(transform.position.x - spawnRange / 2, transform.position.x + spawnRange / 2), transform.position.y + OffsetY, Random.Range(transform.position.z - spawnRange / 2, transform.position.z + spawnRange / 2)); GameObject gO = enemyPool.SpawnFirstAvailableObject(pos, Quaternion.identity); var enemyScript = gO.GetComponent <Enemy>(); int type = Random.Range(1, 4); Debug.Log("Spawning creep: number " + type + " type " + (EnemyType)type); enemyScript.type = (EnemyType)type; gO.name = enemyScript.type.ToString(); return(enemyScript); }