- Home /
c# set main camera to player (multiplayer)
Camera.main.GetComponent(cameraController).target = transform;
Keeps giving me: expression denotes a type..... (Error CS0119)
Answer by Maerig · May 21, 2014 at 03:17 AM
Here GetComponent()
expect either a string
or a type
parameter. You need to use GetComponent("CameraController")
, GetComponent(typeof(CameraController))
, or even better GetComponent< CameraController >()
. Note that you will also need to cast the result, except for the last one.
Thanks man, I just needed some help getting the ball rolling again... $$anonymous$$y brain as on complete lost mode lol.
Your answer
Follow this Question
Related Questions
Networked Game Issues - Camera does not follow script 1 Answer
C# - Offset In-Air Camera from Current Object Position 1 Answer
Input Controls Camera on a Predetermined Path. 1 Answer
How to make remote player's healthbar GUI look at local player's camera? 0 Answers
Lock on opponent in UNET (C#) 1 Answer