For the death/win screen of my game I've added a depth of field script that works for the win screen but not the death screen? It's the exact same code in the if statement and I've tried debugging it using
print ("collider working");
and it came up in the console but the components weren't activated.
#pragma strict
public var TestObj : GameObject;
function Start () {
(GetComponent("CameraOrbit") as MonoBehaviour).enabled = false;
(GetComponent("DepthOfFieldDeprecated") as MonoBehaviour).enabled = false;
}
function Update () {
if(CaffeineScript.Dead==true){
print ("collider working");
(GetComponent("DepthOfFieldDeprecated") as MonoBehaviour).enabled = true;
(GetComponent("CameraOrbit") as MonoBehaviour).enabled = true;
}
else{
(GetComponent("DepthOfFieldDeprecated") as MonoBehaviour).enabled = false;
(GetComponent("CameraOrbit") as MonoBehaviour).enabled = false;
}
if(CaffeineScript.Win==true){
(GetComponent("DepthOfFieldDeprecated") as MonoBehaviour).enabled = true;
(GetComponent("CameraOrbit") as MonoBehaviour).enabled = true;
}
else{
(GetComponent("DepthOfFieldDeprecated") as MonoBehaviour).enabled = false;
(GetComponent("CameraOrbit") as MonoBehaviour).enabled = false;
}
}
↧