I can do (in C#) :
myCamera.GetComponent<CameraRecoil>().enabled = true; //CameraRecoil is a C# Script
I can’t do (in C#) :
myCamera.GetComponent<CameraZoomShader>().enabled = true; //CameraZoomShader is a JS Script.
HELP!
I can do (in C#) :
myCamera.GetComponent<CameraRecoil>().enabled = true; //CameraRecoil is a C# Script
I can’t do (in C#) :
myCamera.GetComponent<CameraZoomShader>().enabled = true; //CameraZoomShader is a JS Script.
HELP!
The script you want to have access (JS Script in your case) must be inside the “Standard Assets” or the “Plugins” folder. The other script (C# Script in your case) which calls GetComponent method has to be placed outside these folders.
Ah, okay, that makes sense - thanks!
Hmm for some reason it actually still isn’t working…