// Use this for initialization void Start() { floorManager = GameObject.Find("FloorManager").GetComponent <FloorManager>(); GameObject customer; foreach (Transform child in people.transform) { CustomerView customerView = people.transform.Find(child.name).GetComponent <CustomerView>(); if (customerView.isSelected) { customerView.Stop(); customer = child.gameObject; backButton.onClick.AddListener(() => backClick(customer)); } } }