- Home /
Question by
mmangual_83 · Jan 22, 2014 at 03:31 PM ·
c#
How to work with cameras
I have a class where I have a camera variable called viewport1 and then in the Start method I am initializing it as : viewPort1 = GameObject.Find("IsometricCamera"); but all I get is an error "cannot implicitly convert type UnityEngine.GameObject to UnityEngine.Camera
Comment
Best Answer
Answer by MakinStuffLookGood · Jan 22, 2014 at 03:41 PM
Find returns the game object, you want the camera component on that object. Try either:
viewPort1 = GameObject.Find("IsometricCamera").camera;
or
viewPort1 = GameObject.Find("IsometricCamera").GetComponent<Camera>();
Only the second way works now:
viewPort1 = GameObject.Find("IsometricCamera").GetComponent();
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
A node in a childnode? 1 Answer
Button to change layers 1 Answer
Admob code question 1 Answer