Tree Spawning Question

Ok so I need to try to make tree’s spawn in a area on my map so I connected a script to a single tree in my game and tried using for loops, while loops, compound for statements, everything possible they rather do one of two things lock up unity or absolutely nothing. I have referenced to the documentation of unity and still not success. But rather much of what I have already tried. Should I use a clone objected instantiate or just a standard one like I have been trying. So please if anyone has ideas let me know.

using UnityEngine;
using System.Collections;

public class ResourceSpawn : MonoBehaviour
{
	bool gamefirst = true;
	public Transform tree;

	void Start ()
	{
		
		
	}
	
	void Update ()
	{
		if(gamefirst == true)
		{
			for (int t = 0; t < 20; t++)
			{
				Instantiate (tree, Vector3(t * 8.0f, 0f, 0f), Quaternion.identity);
			}
			gamefirst = false;
		}
	}
}

That’s odd that you claim this freezes up Unity or the game runs but the script doesn’t do anything. This won’t even get to the point of running, because the code will not compile. You are using a variable named ‘i’, which doesn’t exist in your for loop. Change this to ‘t’, since that’s what you named your integer in the first place. You’re also not using the ‘new’ keyword on your Vector3, which is required in C# in this case. Oy. Might as well show you, since this question is better asked than your duplicate.

using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour
{
    bool gamefirst = true;
	public Transform tree;
     
    void Update ()
    {
        if(gamefirst)
        {
            for (int t = 0; t < 20; t++)
            {
                Instantiate (tree, new Vector3(t * 8.0f, 0f, 0f), Quaternion.identity);
            }
            gamefirst = false;
        }
    }
}