Search Unity

Lerpz Tutorial - cutscene camera script not working for me

Discussion in 'Scripting' started by GarethF, Oct 9, 2010.

  1. GarethF

    GarethF

    Joined:
    Oct 6, 2010
    Posts:
    16
    If I manually enable the cut scene camera, it renders. But enabling it via script doesn't seem to work, the camera doesn't show up.

    So :

    Code (csharp):
    1.  
    2. unlockedCamera.active = true;
    doesn't show anything, and yes I have the camera linked to the unlocked Camera field. I've got a little debug script running which spams the log, it says the camera is active? The reference says 'active' means it will get updates, is it also gonna render or do I need to call another function?

    Thanks.
     
  2. LamentConfig

    LamentConfig

    Joined:
    Sep 28, 2010
    Posts:
    292
    I haven't looked at the Lerpz tutorial so sure there are others who can be more helpful, do you make sure you de-activate all the other cameras? do you get any errors when trying that bit of code?
     
  3. GarethF

    GarethF

    Joined:
    Oct 6, 2010
    Posts:
    16
    Figured it out. The tutorial says to set the active property on the game object. That doesn't work, but if you set the enabled property of the camera component of the game object, that works.

    So instead of this :

    Code (csharp):
    1. unlockedCamera.active= true;
    you use this :

    Code (csharp):
    1. unlockedCamera.camera.enabled = true;
    I'm not yet sure what the different between a game object being active and a component being enabled are.