void Start() { BaseStar baseStar = GetComponent <BaseStar>(); for (int i = 0; i < dirtyIslands.Length; i++) { for (int j = 0; j < dirtyIslands[i].transform.childCount; j++) { Transform tr = dirtyIslands[i].transform.GetChild(j).gameObject.transform; MeshFilter[] meshes = dirtyIslands[i].transform.GetChild(j).gameObject.GetComponents <MeshFilter>(); for (int k = 0; k < meshes.Length; k++) { if (meshes[k].mesh == null) { continue; } Vector3[] verts = meshes[k].mesh.vertices; for (int l = 0; l < verts.Length; l++) { Instantiate(testSphere, tr.TransformPoint(verts[l]), Quaternion.identity); } } } } }