Need help with camera switching. Basically, there is a camera in the corner of the room where the player can look around, for 10 seconds, then it switches to a camera on the bed. All I see online is camera switch with code and pressing buttons, but I dont need that. My teacher mentioned something about turning a camera off and the other one on…but I dont see him till tommorow and want to finish it tonight. Really need help due to my deadline being this Friday!
Use a Coroutine.
public Camera cam_1;
public Camera cam_2;
public float waitTime = 10f;
void Start() {
cam_2.enabled = false;
StartCoroutine(SwitchCamera());
}
private IEnumerator SwitchCamera() {
yield return new WaitForSeconds(waitTime );
cam_1.enabled = false;
cam_2.enabled = true;
}
Hey @Cherno, thanks for the code. I am out for a little while, but will be home to test it out. Silly question but will it be as easy as just creating a script and adding the code…voila it works? Or will other steps need to be completed in order for it to work? Specific names at specific parts of the code? e.g 'waitTime ', will it be ‘waitTime 10seconds);’?