Tree spawning problem

i want to make a tree script that spawns new trees around old trees, but i keep having the issue of them spawning in large numbers above the value i have set for them wich is 10, also my trees spawn at 0,0,0, on the map wich is not what i need. how can i spawn them next to an other tree whitin a certain distance ofcourse. any advice would be appreciated. thx

public float MaxTreeHeight = 10.0f;				//Tree Growth Max Hieght
public float TreeGrowthSpeed = 0.1f;			//Tree Growth Speed
public bool TreeGrowthEnabled = true;			//Growing Tree?
public bool Spawning = true;					//Spawn Tree?
public float SpawningTimer = 0.1f;				//If Spawn = True, Set Timer To Instantiate Tree
public GameObject MyTreeTypePrefab;				//Assign Witch Tree Type Should be Spawnd
public float MyTreeTypeDistance = 4.0f;			//Spawn Tree Distance from main Tree
public int i = 0;								//Variable for Tree Spawning Distance
public int SpawnMaxNumber = 0;					//Variable for max number of Tree Spawns 

void start () {


void Update () 
//Growing Tree?
	if (transform.localScale.x < MaxTreeHeight) 					//max Tree hieght
		TreeGrowthEnabled = true;
		transform.localScale += new Vector3(0.1f,0.1f,0.1f) * TreeGrowthSpeed * Time.deltaTime;	//growth speed
	else if (transform.localScale.x > MaxTreeHeight)
		TreeGrowthEnabled = false;
		Spawn ();

void Spawn ()
//Spawn Tree?
	if (transform.localScale.x > 2 && SpawnMaxNumber < 10)
		for (i = 0; i < 9; i++) {
			Spawning = true;
			Instantiate (MyTreeTypePrefab, new Vector3 (i * 2.0f, 0, 0), Quaternion.identity);
			SpawnMaxNumber += 1;
			Debug.Log ("Spawned A Tree" + i);
	if (transform.localScale.x < 1)
		Spawning = false;


Insisde of spawn() you check for spawMaxNumber and then loop 8 timesin the for, this will make it so that you will spawn 16 times.
On instantiate, you’re passing “new Vector3 (i * 2.0f, 0, 0)” as the spawn position, this is in world coordinates, you want to do “transform.position + positionAwayFromTree”, how you calculate positionAwayFromTree is up to you.
There’s many ways to calculate it: Random, going in a circle arround the tree, or other crazy stuff.
You then also would probably want trees to dont spawn inside eachother, wich means, in the case of random, for example, you need to check for collision, so keep that in mind.