public void spawnTrees(Fairway fairway) { for (int i = 0; i < treeOptions.numberOfTrees; i++) { var pos = MathfEx.RandomPointOnTerrain(terrain); if (fairway.isPointInsideOuterHull(pos)) { continue; } var randPrefab = treeOptions.randomTreePrefab; Quaternion rot = Quaternion.identity * Quaternion.Euler(0, Random.value * 360, 0); var obj = GameObject.Instantiate(randPrefab, pos, rot); obj.transform.localScale = Vector3.one * (1f + Random.Range(-treeOptions.treeScaleVariance, treeOptions.treeScaleVariance)); } }