greatings ! My mainly problem is i create a [island][1]** to my game. and I wanted to randomly do tree etc. to this system. but the code is spawned flat. I want it to be spawned separately, but specifically for the mesh.
the code i mentioned
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TerrainWorldGenerator : MonoBehaviour
{
public GameObject obj;
public GameObject treeinworldobj;
public int objamount;
List<GameObject> objlist = new List<GameObject>();
GameObject[] objArray;
private void Start() {
for(int i = 0; i <= objamount; i++){
objlist.Add(Instantiate<GameObject>(obj));
objArray = objlist.ToArray();
objArray*.transform.position = new Vector3(Random.Range(-50, 50), 0, Random.Range(-50, 50));*
objArray*.transform.parent = treeinworldobj.transform;*
}
}
}
[what i want][2] **
[what is happening now][3] **
(Click on the text to access the picture) **
[1]: Procedural Terrain Generation - YouTube
_[2]: https://imgur.com/SsmwP81*_
_[3]: https://imgur.com/a/xDWaJJ8*_