Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Unable to disable a C# script with a JS Script

$
0
0
I can't seem to disable "DepthOfField.cs" with my "Bino.js" script, this is the code used: #pragma strict var zoom : int = 20; var glassesVision : int = 80; var normal : int = 90; var smooth : float = 5; private var isZoomed = false; //Glasses functions var GlassesImageOn = false; var GlassesImage : GameObject; var dof : DepthOfField; function Start () { GlassesImage.SetActive (false); dof = gameObject.GetComponent("DepthOfField"); } function Update () { if(Input.GetMouseButtonDown(2)) { isZoomed = !isZoomed; } if(isZoomed == true) { GetComponent.().fieldOfView = Mathf.Lerp(GetComponent.().fieldOfView, zoom, Time.deltaTime * smooth); } else { GetComponent.().fieldOfView = Mathf.Lerp(GetComponent.().fieldOfView, normal, Time.deltaTime * smooth); } if(Input.GetKeyDown("g")){ GlassesImageOn = !GlassesImageOn; } if(GlassesImageOn == true){ GlassesImage.SetActive (true); dof.SetActive (false); GetComponent.().fieldOfView = Mathf.Lerp(GetComponent.().fieldOfView, glassesVision, Time.deltaTime * smooth); }else{ GlassesImage.SetActive (false); dof.SetActive (true); GetComponent.().fieldOfView = Mathf.Lerp(GetComponent.().fieldOfView, normal, Time.deltaTime * smooth); } } I get this error when i try to run it: Assets/Bino.js(14,11): BCE0018: The name 'DepthOfField' does not denote a valid type ('not found'). Did you mean 'UnityStandardAssets.ImageEffects.DepthOfField'? When i search the forums and questions/answers and none of them suit unity 5, so i'm stuck trying to figure this out.

Viewing all articles
Browse latest Browse all 1875

Trending Articles