Very straightforward- im trying to spawn an ngui label over a gameobject’s position. Heres the code I’m using to get that to happen…
public void ComplementPlayer(GameObject prefab, Vector3 position)
{
Vector3 newPos = Camera.main.WorldToScreenPoint (position);
Vector3 anotherNewPos = uiCamera.ScreenToWorldPoint (newPos);
Debug.Log (newPos + "
" + anotherNewPos);
GameObject go = NGUITools.AddChild(gameObject, prefab);
currentComplement = go;
go.transform.localPosition = newPos;
StartCoroutine (Despawn(go));
}
im using world to screen point which i what ive seen all the other answers reference but for some reason it just isnt quite working. The ngui label just spawns way off screen. I’m sure its something simple that I’m doing wrong but can someone point me in the right direction on this?