IEnumerator AsyncDrawText(WorldGUITextInfo info) { var text = Instantiate(damageTextPrefab, Vector3.zero, Quaternion.identity) as GameObject; text.GetComponent <GUIText>().text = info.text; var startTime = Time.time; while (Time.time - startTime < 1.0f) { var pos = Camera.main.WorldToViewportPoint(info.position); pos.z = 1.0f; text.GetComponent <GUIText>().transform.localPosition = pos; yield return(null); } Destroy(text); }
IEnumerator AsyncDrawText(WorldGUITextInfo info) { var text = Instantiate(damageTextPrefab, Vector3.zero, Quaternion.identity) as GameObject; text.GetComponent<GUIText>().text = info.text; var startTime = Time.time; while(Time.time - startTime < 1.0f) { var pos = Camera.main.WorldToViewportPoint(info.position); pos.z = 1.0f; text.GetComponent<GUIText>().transform.localPosition = pos; yield return null; } Destroy(text); }
public void DrawText(WorldGUITextInfo info) { StartCoroutine(AsyncDrawText(info)); }
public void DrawText(WorldGUITextInfo info) { StartCoroutine(AsyncDrawText(info)); }