This question was
closed Jan 22, 2019 at 07:23 PM by
Pizyabra for the following reason:
Transform maincam = GameObject.Find("Main Camera").GetComponent(); Seem to work right
How to get the position of the Main Camera
Hi All, Sorry for a dumb question but Im having trouble with understanding the transform.position of the main camera.
Camera maincam = GameObject.Find("Main Camera").GetComponent<Camera>();
Debug.Log(maincam.transform.position);
Well this is working well, although my firt try was:
Transform maincam = GameObject.Find("Main Camera").GetComponent<Transform>();
And this doesnt't work. What I was trying is get the camera object from the hierarchy by Gameobject.Find, and then get the transform component, but it is not right.
The camera component shown on the pic below doesn't contain such option as transform. Can someone please explain?
unityquest2.jpg
(34.0 kB)
Comment