- Home /
How do i turn on and off a network camera?
this is the part in the script attached to a playerprefab. The prefab contains the camera and the player.
void Start() if(networkView.isMine) { GetComponent< Camera >.enabled = true; } else { GetComponent< Camera >.enabled = true; }
i also tried GetComponent(0,Camera).enabled = true; and GetComponent(Camera).enabled = true;
i get errors like these Assets/Scripts/PlayerControl.cs(19,25): error CS0119: Expression denotes a method group', where a
variable', value' or
type' was expected
Assets/Scripts/PlayerControl.cs(25,40): error CS0119: Expression denotes a type', where a
variable', value' or
method group' was expected
Assets/Scripts/PlayerControl.cs(25,25): error CS1501: No overload for method GetComponent' takes
2' arguments
i basically get an error then to fix that i cause another error.. please help.
Please format your code using the little "101010" button so we can read it. Also, please tell us what lines 19 and 25 of your code contain - your error messages are telling us that these are the lines that have problems. Finally, look up all your error codes in Google to see what they mean. CS1501, for example, is an error code.