Script has been added to my object but it cannot be found using GetComponent() (174285)

This is my code in my Update() function:

if(Input.GetMouseButton(0)){
					seePainting();
					this.gameObject.GetComponent<Blur>().enabled = true;
				}
				if(Input.GetMouseButton(1)){
					this.gameObject.GetComponent<Blur>().enabled = false;
				}

Unity says that that Component cannot be found. My script has been added to the FirstPersonCharacter camera along with the Blur script. What’s wrong?

Do you get the error at compile time or run time? Can you show the Blur script?

1 Answer

1

Add this to your script:

using UnityStandardAssets.ImageEffects;

Thanks it works now. Why isn't it recognize the Blur script?