Cannot implicitely convert type 'CameraMove' to UnityEngine.Camera
I have public Camera cam;
And then
Start () {
cam = Camera.main.GetComponent<CameraMove>();
}
But it gives the error:
Cannot implicitely convert type 'CameraMove' to UnityEngine.Camera
Any ideas for this? Thanks
Comment
Answer by Dave-Carlile · Oct 05, 2015 at 03:17 PM
You're trying to assign something with a CameraMove
data type to a variable that's a Camera
data type.
Declare your cam
variable as CameraMove
.
CameraMove cam;
cam = Camera.main.GetComponent<CameraMove>();
Your answer
![](https://koobas.hobune.stream/wayback/20220612040123im_/https://answers.unity.com/themes/thub/images/avi.jpg)