I'm developing (or rather butchering) plugin for Rust, which was build in Unity, and I need to create a targeting system. Unfortunately I got stuck on WorldToScreenPoint
and WorldToViewportPoint
. It seems that the Camera.main
is not what player sees and is not moving at all. Also it has different resolution from what the game is set up.
Unfortunately I can't use Unity and all the work needs to be done in VS.
Does anyone has a suggestion how to get a "proper" camera for this?
Thank you in advance
EDIT
As requested this is my code: Debug.log(Camera.main.WorldToScreenPoint(bAnimalNPC.transform.position).x.ToString())
Debug.log(Camera.main.WorldToScreenPoint(bAnimalNPC.transform.position).y.ToString())
Debug.log(Camera.main.WorldToScreenPoint(bAnimalNPC.transform.position).z.ToString())
The rest is just getting the bAnimalNPC
and doing some checks.