public void AddTimeSlot(Room room, Reservation res) { GameObject slot = GameObject.Instantiate(timeslotPrefab, this.transform); AvailableTimeView timeView = slot.GetComponent <AvailableTimeView>(); timeView.SetRoomReservation(room, res); timeView.SetAllText(); float height = timeslotPrefab.GetComponent <RectTransform>().rect.height; timeView.GetComponent <RectTransform>().localPosition += new Vector3(0, -height * 1.5f * availableTimeViews.Count, 0); availableTimeViews.Add(timeView); }