cam script doent work at all

hey guys can some one fix my script dont know whats wrong al the things i get dont work so i made this based on some other scripts

i just wanted to view after 10 secs camera 2 thas all

function Start () {
  camera1.enabled = true;
  camera2.enabled = false;
  camera3.enabled = false;
}

function Update () {
  yield WaitForSeconds (10);
  camera1.enabled = false;
  camera2.enabled = true;
  camera3.enabled = false;
}
}

so the game starts your viewing on camera1 becous tahats the first can in the sene that works my animation takes 10 secs of my ship passing by than i wanted to go after 10 secs to camera2 i hope you know what i want its just simple but i cant get it to word and the other guys i thank them for the work and time but thay dont know what i mean. thay keep asking me about things. i know nopthing aboute i cant be to hard to switch view from one camera to an other

so thanka again

2 Answers

2

You can't use '`yield WaitForSeconds();`' in '`Update()`'. This will work, however:

function Start ()
{
  camera1.enabled = true;
  camera2.enabled = false;
  camera3.enabled = false;

  yield WaitForSeconds(10);
  camera1.enabled = false;
  camera2.enabled = true;
}

  function Start () 
       {
  camera1.enabled = true;
  camera2.enabled = false;
  camera3.enabled = false;
  delay1(); //user defined function
       }

   function delay1()        
      {
      yield WaitForSeconds (10);
      camera1.enabled = false;
      camera2.enabled = true;
      }

you cannot call yield statement from update function

unchecked codes

if you find this worked for you means mark as correct answer

@Marowi, @robertmathew: Your answers are the same.