public static void cteatefloatingtext(string text, Transform location) { floating_text instance = Instantiate(popuptext); Vector2 screenposition = Camera.main.WorldToScreenPoint(location.position); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenposition; instance.settext(text); }
public static void Initialize() { canvas = GameObject.Find("Canvas"); if (!popuptext) { popuptext = Resources.Load <floating_text>("prefebs/Text_popup"); } if (!popuptext2) { popuptext2 = Resources.Load <Floating_text2>("prefebs/Text_popup2"); } }