public void test() { GameObject newHoverPanel = Instantiate(HoverPanelPrefab) as GameObject; HoverPanel panel = newHoverPanel.GetComponent <HoverPanel> (); panel.CharacterName.text = this.characterName; panel.CharacterID.text = this.ID.ToString(); var mousex = (Input.mousePosition.x); var mousey = (Input.mousePosition.y); var mouseposition = Camera.main.ScreenToWorldPoint(new Vector3(mousex, mousey, 0)); newHoverPanel.transform.localPosition = new Vector3(mouseposition.x, mouseposition.y, 0); panel.transform.SetParent(EmployeePrefabContentPanel); newHoverPanel.gameObject.transform.localScale = new Vector3(1, 1, 1); if (this.gender == 'M') { HelloMan hm = GameObject.FindWithTag("HelloMan").GetComponent <HelloMan>(); hm.playSound(); } else { HelloGirl hg = GameObject.FindWithTag("HelloGirl").GetComponent <HelloGirl>(); hg.playSound(); } }
public void OnPointerEnter(PointerEventData eventData) { if (!barMode) { return; } hp = Instantiate(hoverPrefab, canvas).GetComponent <HoverPanel>(); hp.MakeSubstrate(this); }