public void AddQuizPin() { GameObject pinObj = Resources.Load(GlobalData.resourcePath + "/Prefabs/QuizPinIcon") as GameObject; if (PinParent.Find("DialoguePin")) { pinObj = Instantiate(pinObj.transform.Find("ShowQuiz").gameObject, PinParent.Find("DialoguePin")); } else { pinObj = Instantiate(pinObj, PinParent); pinObj.SetActive(!pinStartHidden); } Button b = pinObj.GetComponentInChildren <Button>(); b.onClick.AddListener(delegate { Transform t = Instantiate(Resources.Load(GlobalData.resourcePath + "/Prefabs/Panels/QuizPopUp") as GameObject, DS.transform).transform; t.gameObject.SetActive(true); t.GetComponentInChildren <ReaderEntryManagerScript>().SetPin(b.transform); t.GetComponentInChildren <ReaderEntryManagerScript>().PopulatePanel(b.transform); t.Find("Image").GetComponent <Image>().color = DS.GetImage(TM.getCurrentSection()).color; }); pinObj.tag = "Value"; pinObj.name = "Quiz" + "Pin"; }
public void ShowPins() { var pin = PinParent.Find("DialoguePin"); if (!pin) { pin = PinParent.Find("QuizPin"); } if (pin) { pin.gameObject.SetActive(true); } }