- Home /
Placing 3Dtext with Perspective Camera
I'm instantiating on runtime a TextMesh prefab that needs to be in the screen top-corner upon game start, with a orthographic camera (Always worked in 2D environment so I don't know anything about perspective) it's enough to use Camera.main.ScreenToWorldPoint but apparently that's not a workin option when the camera is Perspective.
The code so far :
void Start ()
{
GameObject txtMeshTransform = Instantiate(Go) as GameObject;
TextLine.Add(txtMeshTransform.GetComponent<TextMesh>());
ApplyToLine.Add("Hello warudo");
TextLine[0].text = ApplyToLine[0];
txtMeshTransform.transform.position = new Vector3(
Camera.main.ScreenToWorldPoint(new Vector3(0f, 0f, 0f)).x + 1.2f,
Camera.main.ScreenToWorldPoint(new Vector3(0f, Screen.height, 0f)).y - 0.43f,
Camera.main.farClipPlane - 20f);
}
Comment
This is a duplicate of http://answers.unity3d.com/questions/729522/placing-3dtext-with-perspective-camera.html and should be closed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613151814im_/https://answers.unity.com/themes/thub/images/avi.jpg)