Referencing DOF in a script? (Unity 5)

Hey guys, I am trying to make a script to change the object that DOF focuses on dynamically within my script. Its working smoothly other than the fact I can’t actually reference the DepthOfField script within my script. Any suggestions?

using UnityEngine;
using System.Collections;

public class DOFCameraFocusScript : MonoBehaviour {

	public float maxFocusDistance = 1000;

	public GameObject camera;
	
	public Component depthOfFieldScript;

	// Update is called once per frame
	void Update () 
	{
		if (camera == null)
		{
			camera = Camera.current.gameObject;
		}

		depthOfFieldScript = camera.GetComponent <DepthOfField> ();

		RaycastHit hit;

		if (Physics.Raycast(camera.transform, camera.transform.TransformDirection, out hit, maxFocusDistance))
		{
			DepthOfField.focalTransform = hit.collider.gameObject;
		}
	}
}

yea line 26.

DepthOfField is a class but it’s just a class.

its not the actual cameras depth of field it’s just a definition of what depth of fields are and how you can change them. This is the blueprint for ford mustangs for example not your ford mustang.

Something like camera.main.depthoffield is how your going to get the actual cameras depth of field.

Declare:
public UnityStandardAssets.ImageEffects.DepthOfField dof;

Awake:
dof = GetComponent();

You need to copy the script to your assets folder (or any subfolder in it) and then reference the namespace UnityStandardAssets.ImageEffects. Then you’ll be able to reference the script.