Wait time Before Camera Switching?
Is it possible to have a slight delay before camera switching with this script? Reason I ask is because some stuff does not play nice with certain public void functions. I think an IEnumerator might work here but fuzzy on how to code that?
using UnityEngine;
using System.Collections;
public class CameraSwitcher : MonoBehaviour {
public GameObject camera1;
public GameObject camera2;
public GameObject camera3;
//public GameObject camera4;
public void EnableCamera1() {
camera1.SetActive(true);
camera2.SetActive(false);
camera3.SetActive(false);
//camera4.SetActive(false);
}
public void EnableCamera2() {
camera1.SetActive(false);
camera2.SetActive(true);
camera3.SetActive(false);
//camera4.SetActive(false);
}
public void EnableCamera3() {
camera1.SetActive(false);
camera2.SetActive(false);
camera3.SetActive(true);
//camera4.SetActive(false);
}
/*public void EnableCamera4() {
camera1.SetActive(false);
camera2.SetActive(false);
camera3.SetActive(false);
camera4.SetActive(true);
}*/
}
Search around in general for: adding a delay, using a timer or "waiting". Lots of info here on how to do it, in various ways.
I must do lousy searches or something because I was not finding a lot of specific "How Too" stuff out there. $$anonymous$$aybe I don't use the correct search terms?
Your answer
Follow this Question
Related Questions
How to wait a certain amount of seconds in C# 4 Answers
I would like to add a delay to activating a camera 2 Answers
need help for adding a delay code before walking of npc 2 Answers
Change Camera postion 1 Answer
Resetting Camera Position 1 Answer