- Home /
wait for ten seconds, then change camera,wait for seconds then change camera
i want to start my scene, wait ten seconds and change camera from cam1 to cam2. i'm pretty new to unity,. i tried this script and it didnt work. can somebody pls help me? IEnumerator Test() { yield return new WaitForSeconds(10); cam1.GetComponent().enabled = false; cam2.GetComponent().enabled = true; }
,i want to start my scene, then wait ten seconds and then change my camera from cam1 to cam2. i'm new to unity, and i tried this script and it didn't work. can someone pls help me? IEnumerator Test() { yield return new WaitForSeconds(10); cam1.GetComponent<Camera>().enabled = false; cam2.GetComponent<Camera>().enabled = true; }
What exactly isnt working? The camera doesn't become active? Or does it not run at all? If the second is the case, have you actually started the function Test? You can do this like this:
public void Start()
{
StartCoroutine(Test());
}
Your answer
Follow this Question
Related Questions
Very (very) Simple NPC movement pattern... 2 Answers
How wait few second in c# 2 Answers
Cant Make C# Use waitforseconds Command 3 Answers
how do i wait a second without Coroutine 1 Answer
Wait n-seconds before loading level 1 Answer