void Start() { plantList = new List<GameObject>(); mainTreeLeaves = GameObject.Find("Main Tree Leaves"); treeScript = mainTreeLeaves.GetComponent<MainTreeLeavesScript>(); Vector3 treeLeavesPos = mainTreeLeaves.transform.position; for (int i = 0; i < startInsects; i++) { Vector3 spawnPoint = new Vector3 ( treeLeavesPos.x + Random.Range(-randPosRange, randPosRange), treeLeavesPos.y + Random.Range(-randPosRange, randPosRange), treeLeavesPos.z + Random.Range(-randPosRange, randPosRange)); Instantiate(insect, spawnPoint, Quaternion.identity); } }
void Start() { plantList = new List <GameObject>(); mainTreeLeaves = GameObject.Find("Main Tree Leaves"); treeScript = mainTreeLeaves.GetComponent <MainTreeLeavesScript>(); Vector3 treeLeavesPos = mainTreeLeaves.transform.position; for (int i = 0; i < startInsects; i++) { Vector3 spawnPoint = new Vector3( treeLeavesPos.x + Random.Range(-randPosRange, randPosRange), treeLeavesPos.y + Random.Range(-randPosRange, randPosRange), treeLeavesPos.z + Random.Range(-randPosRange, randPosRange)); Instantiate(insect, spawnPoint, Quaternion.identity); } }