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;
}
}
}