void Start(){ foreach (GameObject searchable in GameObject.FindGameObjectsWithTag("Search")) { //creates list of searchable gameobjects searchSpots.Add(searchable); } for (int i = 0; i < searchSpots.Count; i++) { //createes a list of items for mom and dad relative to searchable objects DadRandom(Random.Range(0,6)); dadItems.Add(temp); MomRandom(Random.Range(0,6)); momItems.Add(temp); } momItems[Random.Range(0,searchSpots.Count)] = "Rope"; //insert rope randomly into mom's list for (int i = 0; i < searchSpots.Count; i++) { //assigns items out to searchable gameobjects objectScript = searchSpots[i].GetComponent<ObjectHolder>(); objectScript.SetItems(momItems[i],dadItems[i]); } }