So, I’m trying to convert the position of a GUITexture to the pixel position but I keep getting a NullReference Exception whenever I try. Here is my code:
Vector3 barPos;
Debug.LogWarning(sensitivityBar.transform.position);
barPos = Camera.current.ViewportToScreenPoint(sensitivityBar.transform.position);
I get the NullReference Exception when I get to the ViewportToScreenPoint function. I have no idea why this is happening. Any help would be much appreciated. Thank you.