So I'm making a random tree spawner however, the trees are spawning outside of the terrain bounds. Any ideas as to what I need to change to fix this? Image of the current results is this https://flic.kr/p/2oeJqCu Code (CSharp): public class TreeSpawner : MonoBehaviour{ public GameObject treePrefab, treeParent; public int treeAmount; List<GameObject> treesList = new List<GameObject>(); GameObject[] treesArray; public GameObject Terrain; void Start(){ Vector3 TerrainSize = Vector3.Scale(transform.localScale, Terrain.GetComponent<MeshCollider>().bounds.size); for (int i = 0; i <= treeAmount; i++){ treesList.Add(Instantiate<GameObject>(treePrefab)); treesArray = treesList.ToArray(); treesArray[i].transform.position = new Vector3(Random.Range(TerrainSize.x ,TerrainSize.y), 0, Random.Range(TerrainSize.x, TerrainSize.y)); treesArray[i].transform.parent = treeParent.transform; } } }