void CreateFBEvent(string name, int index) { GameObject item = Instantiate(EventFrontpageScrollPrefab); item.transform.SetParent(content); FrontpageObjects itemObject = item.GetComponentInChildren <FrontpageObjects>(); itemObject.SetObjectInfo(name, index); frontpageobjects.Add(itemObject); FrontpageObjects temp = itemObject; // function til at slette prefab men find måde at gøre det hvis det overskrider en bestemt dato itemObject.GetComponent <Toggle>().onValueChanged.AddListener(delegate { CheckItem(temp); }); }
void CheckItem(FrontpageObjects item) { frontpageobjects.Remove(item); }