So I was given this code for camera switching in ONE scene/level. First time posting code so hopefully it works
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;
}
So cam1 switches to cam2 after 10 seconds…
But I then needed something else to happen. My scene: cam1 is on level 1, cam2 (different position) is on level 2 (I still have cam1 on level 2 aswell). I need to have the player look through camera 1 (on level 1) for 30 seconds, then it switches to another level and look through camera 2. I have the level change, so it looks through cam 1 (level) for a few seconds, and then switches to level 2, but it just looks through camera 1 that is still on level 2). I know something to do with camera switching on level 2 is missing or something wrong but have no clue!
Here is the code I currently have:
using UnityEngine;
using System.Collections;
public class Camera_Switch : MonoBehaviour {
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 );
Application.LoadLevel(1);
}
}
This imgur image should give a better picture visually as to the problem Imgur: The magic of the Internet