void ShowPopupText(string dmg, Vector3 pos, PopupText obj) { PopupText damage = Instantiate(obj); damage.transform.SetParent(GameObject.Find("FrontCanvas").transform, false); damage.transform.localScale = new Vector3(1, 1, 1); damage.SetPopupText(dmg.ToString()); damage.transform.position = new Vector3(pos.x, pos.y + 0.25f, pos.z); }
public void CreatePopupText(string text, Vector3 location, Color textColor) { Vector2 screenPosition = gameBoard.cameraController.ACTIVE_CAMERA.WorldToScreenPoint(location); Debug.Log("CreatePopupText @ " + screenPosition); if (screenPosition != null) { PopupText instance = Instantiate(popupText); instance.transform.SetParent(gameBoard.canvas.transform, false); instance.transform.position = screenPosition; instance.SetPopupText(text, textColor); } }