void Start() { // Get all Terrain Chunks foreach (Transform child in transform) { Vector2 position = new Vector2(child.position.x / chunkWidth, child.position.z / chunkWidth); if (!terrainChunks.ContainsKey(position)) { terrainChunks.Add(position, child.gameObject); } } // Initialize Forest Generator List <GameObject> trees = new List <GameObject>(); foreach (KeyValuePair <Vector2, GameObject> chunkEntry in terrainChunks) { Transform forestTransform = chunkEntry.Value.transform.Find("Forest"); if (forestTransform != null) { foreach (Transform treeTransform in forestTransform) { trees.Add(treeTransform.gameObject); } } } forestGenerator.Init(trees, viewer, objectViewRange); }