// Update is called once per frame void Update() { if (Time.time >= nextSpawnTime) { UpdateSpawnTime(); HasLane spawnedMonster = Instantiate(monster, transform.position, transform.rotation, lanes.transform); spawnedMonster.Lane = lanes.RandomLane(); float yPosition = lanes.CenterOfLane(spawnedMonster.Lane) + Random.Range(-lanePositionJitter, lanePositionJitter) * lanes.LaneHeight; spawnedMonster.transform.position += new Vector3(0, yPosition, 0); } }