I have been trying to make a script that switches cameras when the variable isDead is equal to true in another script. It is returning the error BCE044: Expecting :, found ;
Could someone please tell me what is wrong with my code?
Thanks in advance.
var Normal_Cam : Camera;
var Death_Cam : Camera;
var target : PlayerHealth;
var isDead : boolean;
function Start ()
{
target = transform.parent.gameObject.GetComponent(PlayerHealth);
isDead = target.isDead;
}
function Update()
{
if (isDead === true)
{
Normal_Cam.enabled(false) ;
Death_Cam.enabled(true) ;
}
else
{
Normal_Cam.enabled(true) ;
Death_Cam.enabled(false) ;
}
}
EDIT: Haha I just realized my problem and I changed the code accordingly. But now it says “It is not possible to invoke an expression of type ‘boolean’”. What is wrong?