- Home /
Switching cameras Script error
I just made a script in C# and i dont know exactly what is the error . Can anyone tell me what is the error ? using UnityEngine; using System.Collections;
public class camControl : MonoBehaviour {
// Using First
void Start () {
if Input.GetKey (7)
Debug.Log ("Using Cheating 1")
CheatingSwap(7)
}
// Using Second
void Update () {
if Input.GetKey (9)
Debug.Log("Using Cheating 2")
CheatingSwap(9)
}
}
void camSwap(int currentCam) { GameObject[] cam = FindGameObjectWithTag("cheating");
foreach (GameObject cam in cam) {
Cam theCam = Cam.GetComponent <Camera>()as Camera
theCam.enabled = false ; //Nu stiu
}
string oneToUse = "Camera" + currentCam ;
Camera usedCam = GameObject + GetComponent<Camera>() as Camera
usedCamera.enabled = true ;
} }
Yeah yeah nice tag anyway anyone knows the problem? :)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613061812im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I rotate a Rigidbody to a surface normal AND use camera rotation? 1 Answer
Raycast not rotating with object it casts from 0 Answers
Camera to follow a target within a circle? 1 Answer
camera script, allow free movement of the camera up to a certain distance. 1 Answer
C# locking Main Camera's Rotations 1 Answer